* [patch] sdhci: correct f_min in sd 3.0
@ 2010-09-20 7:32 zhangfei gao
2010-09-24 2:06 ` Chris Ball
2010-09-24 3:24 ` Chris Ball
0 siblings, 2 replies; 7+ messages in thread
From: zhangfei gao @ 2010-09-20 7:32 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Kyungmin Park
[-- Attachment #1: Type: text/plain, Size: 905 bytes --]
>From 83140093bbcd325605135c23740b30b6eeec778f Mon Sep 17 00:00:00 2001
From: Zhangfei Gao <zhangfei.gao@marvell.com>
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@marvell.com>
---
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;
--
1.7.0.4
[-- Attachment #2: 0004-sdhci-correct-f_min-in-sd-3.0.patch --]
[-- Type: text/x-patch, Size: 905 bytes --]
From 83140093bbcd325605135c23740b30b6eeec778f Mon Sep 17 00:00:00 2001
From: Zhangfei Gao <zhangfei.gao@marvell.com>
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@marvell.com>
---
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;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch] sdhci: correct f_min in sd 3.0
2010-09-20 7:32 [patch] sdhci: correct f_min in sd 3.0 zhangfei gao
@ 2010-09-24 2:06 ` Chris Ball
2010-09-24 3:24 ` Chris Ball
1 sibling, 0 replies; 7+ messages in thread
From: Chris Ball @ 2010-09-24 2:06 UTC (permalink / raw)
To: zhangfei gao; +Cc: linux-mmc, Kyungmin Park
Hi,
On Mon, Sep 20, 2010 at 03:32:58AM -0400, zhangfei gao wrote:
> From: Zhangfei Gao <zhangfei.gao@marvell.com>
> 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@marvell.com>
> ---
> 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;
Has anyone else tested this change? Looks correct, but it would be
nice to have a Tested-by or Acked-by on this.
Thanks,
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] sdhci: correct f_min in sd 3.0
2010-09-20 7:32 [patch] sdhci: correct f_min in sd 3.0 zhangfei gao
2010-09-24 2:06 ` Chris Ball
@ 2010-09-24 3:24 ` Chris Ball
2010-09-25 4:23 ` zhangfei gao
1 sibling, 1 reply; 7+ messages in thread
From: Chris Ball @ 2010-09-24 3:24 UTC (permalink / raw)
To: zhangfei gao; +Cc: linux-mmc, Kyungmin Park
Hi,
On Mon, Sep 20, 2010 at 03:32:58AM -0400, zhangfei gao wrote:
> From: Zhangfei Gao <zhangfei.gao@marvell.com>
> 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@marvell.com>
> ---
> 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@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] sdhci: correct f_min in sd 3.0
2010-09-24 3:24 ` Chris Ball
@ 2010-09-25 4:23 ` zhangfei gao
2010-09-28 3:13 ` Chris Ball
0 siblings, 1 reply; 7+ messages in thread
From: zhangfei gao @ 2010-09-25 4:23 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Kyungmin Park
[-- Attachment #1: Type: text/plain, Size: 3494 bytes --]
On Thu, Sep 23, 2010 at 11:24 PM, Chris Ball <cjb@laptop.org> wrote:
> Hi,
>
> On Mon, Sep 20, 2010 at 03:32:58AM -0400, zhangfei gao wrote:
>> From: Zhangfei Gao <zhangfei.gao@marvell.com>
>> 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@marvell.com>
>> ---
>> 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@laptop.org> <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@marvell.com>
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@marvell.com>
---
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
[-- Attachment #2: 0001-sdhci-correct-f_min-in-sd-3.0.patch --]
[-- Type: text/x-patch, Size: 1890 bytes --]
From dc098c73df0872269b3d364462672664450d1df4 Mon Sep 17 00:00:00 2001
From: Zhangfei Gao <zhangfei.gao@marvell.com>
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@marvell.com>
---
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch] sdhci: correct f_min in sd 3.0
2010-09-25 4:23 ` zhangfei gao
@ 2010-09-28 3:13 ` Chris Ball
0 siblings, 0 replies; 7+ messages in thread
From: Chris Ball @ 2010-09-28 3:13 UTC (permalink / raw)
To: zhangfei gao; +Cc: linux-mmc, Kyungmin Park
Hi Zhangfei,
On Sat, Sep 25, 2010 at 12:23:33AM -0400, zhangfei gao wrote:
> From: Zhangfei Gao <zhangfei.gao@marvell.com>
> 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@marvell.com>
> ---
> 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 {
Thanks very much, I've applied this to mmc-next now.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] sdhci: correct f_min in sd 3.0
@ 2010-09-28 4:05 Philip Rakity
2010-09-28 4:58 ` zhangfei gao
0 siblings, 1 reply; 7+ messages in thread
From: Philip Rakity @ 2010-09-28 4:05 UTC (permalink / raw)
To: linux-mmc@vger.kernel.org; +Cc: Zhangfei Gao
The code snippet
> + for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) {
> if ((host->max_clk / div) <= clock)
> break;
is not correct. In sdio 3.0 the value is not a power of 2 for the divider but the value to be divided down-- all the bits count
2) 10-bit Divided Clock
Host Controller Version 3.00 supports this mandatory mode instead of the
8-bit Divided Clock Mode. The length of the divider is extended to 10 bits and all
divider values shall be supported.
3FFh 1/2046 Divided Clock
Philip
Hi Zhangfei,
On Sat, Sep 25, 2010 at 12:23:33AM -0400, zhangfei gao wrote:
> From: Zhangfei Gao <zhangfei.gao@marvell.com>
> 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@marvell.com>
> ---
> 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 {
Thanks very much, I've applied this to mmc-next now.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] sdhci: correct f_min in sd 3.0
2010-09-28 4:05 Philip Rakity
@ 2010-09-28 4:58 ` zhangfei gao
0 siblings, 0 replies; 7+ messages in thread
From: zhangfei gao @ 2010-09-28 4:58 UTC (permalink / raw)
To: Philip Rakity; +Cc: linux-mmc@vger.kernel.org, Zhangfei Gao
On Tue, Sep 28, 2010 at 12:05 AM, Philip Rakity <prakity@marvell.com> wrote:
>
> The code snippet
>> + for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) {
>> if ((host->max_clk / div) <= clock)
>> break;
>
> is not correct. In sdio 3.0 the value is not a power of 2 for the divider but the value to be divided down-- all the bits count
That's the reason using div += 2 instead of div *= 2
> 2) 10-bit Divided Clock
> Host Controller Version 3.00 supports this mandatory mode instead of the
> 8-bit Divided Clock Mode. The length of the divider is extended to 10 bits and all
> divider values shall be supported.
> 3FFh 1/2046 Divided Clock
>
> Philip
>
> Hi Zhangfei,
>
> On Sat, Sep 25, 2010 at 12:23:33AM -0400, zhangfei gao wrote:
>> From: Zhangfei Gao <zhangfei.gao@marvell.com>
>> 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@marvell.com>
>> ---
>> 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 {
>
> Thanks very much, I've applied this to mmc-next now.
>
> - Chris.
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
> One Laptop Per Child
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-28 4:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-20 7:32 [patch] sdhci: correct f_min in sd 3.0 zhangfei gao
2010-09-24 2:06 ` Chris Ball
2010-09-24 3:24 ` Chris Ball
2010-09-25 4:23 ` zhangfei gao
2010-09-28 3:13 ` Chris Ball
-- strict thread matches above, loose matches on Subject: below --
2010-09-28 4:05 Philip Rakity
2010-09-28 4:58 ` zhangfei gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox