mmc: sdhci-sprd: Fix minimum clock limit
Subsystems (3)
PATCH 1/1 mmc: sdhci-sprd: Fix minimum clock limit
From: Wenchao Chen <[email protected]>
The minimum clock supported by SPRD Host is 100000.
--- drivers/mmc/host/sdhci-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-sprd.c +1 -1
@@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_clock(struct sdhci_host *host)static unsigned int sdhci_sprd_get_min_clock (struct sdhci_host *host) { -return 400000 ; +return 100000 ; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host,
Signature · 1 line
2.17.1
Adrian Hunter
maintainerQuoted 3 lines · Wenchao Chen
From: Wenchao Chen <[email protected]>
The minimum clock supported by SPRD Host is 100000.
Commit messages are better if they say why a change is being made.
This begs the question, was there a problem with 400 kHz? Are there cases that benefit from this change? Should it have a fixes tag,cc stable?
Quoted 19 lines
Signed-off-by Wenchao Chen <[email protected]>--- drivers/mmc/host/sdhci-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/host/sdhci-sprd.c +1
-1@@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_clock(struct sdhci_host *host)static unsigned int sdhci_sprd_get_min_clock (struct sdhci_host *host) { -return 400000 ; +return 100000 ; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host,
Quoted 4 lines · Adrian Hunter
Quoted 2 lines · Wenchao Chen
From: Wenchao Chen <[email protected]>
Quoted 9 lines
Quoted 1 line
The minimum clock supported by SPRD Host is 100000.
Commit messages are better if they say why a change is being made.
This begs the question, was there a problem with 400 kHz? Are there cases that benefit from this change? Should it have a fixes tag,cc stable?
Code show as below:
static struct sdhci_ops sdhci_sprd_ops = {
...
.get_min_clock = sdhci_sprd_get_min_clock,
...
};
int sdhci_setup_host(struct sdhci_host *host)
{
...
if (host->ops->get_min_clock)mmc->f_min = host->ops->get_min_clock(host);
...
}
static const unsigned freqs[] = { 400000, 300000, 200000, 100000 }; void mmc_rescan(struct work_struct *work)
{
...
for (i = 0; i < ARRAY_SIZE(freqs); i++) {
unsigned int freq = freqs[i];
if (freq > host->f_max) {
if (i + 1 < ARRAY_SIZE(freqs))
continue;
freq = host->f_max;
}
if (!mmc_rescan_try_freq(host, max(freq, host->f_min))) break;
if (freqs[i] <= host->f_min) // If you start at 100K, you will try 400K, 300K, 200K, 100K.
break;
}
...
}
Our controller supports 100K. During the test, it was found that mmc_rescan failed to scan the card at 400K, and did not try 300K, 200K, and 100K. After modifying the minimum clock limit to 100K, the card scan was successful.
Quoted 20 lines
Quoted 19 lines
Signed-off-by Wenchao Chen <[email protected]>--- drivers/mmc/host/sdhci-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/host/sdhci-sprd.c +1
-1@@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_clock(struct sdhci_host *host)static unsigned int sdhci_sprd_get_min_clock (struct sdhci_host *host) { -return 400000 ; +return 100000 ; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host,
Quoted 50 lines · Wenchao Chen
Quoted 4 lines · Adrian Hunter
Quoted 2 lines · Wenchao Chen
From: Wenchao Chen <[email protected]>
Quoted 9 lines
Quoted 1 line
The minimum clock supported by SPRD Host is 100000.
Commit messages are better if they say why a change is being made.
This begs the question, was there a problem with 400 kHz? Are there cases that benefit from this change? Should it have a fixes tag,cc stable?
Code show as below:
static structsdhci_opssdhci_sprd_ops= {
...
.get_min_clock =sdhci_sprd_get_min_clock,
...
};int
sdhci_setup_host(struct sdhci_host *host)
{
...
if (host->ops->get_min_clock)mmc->f_min=host->ops->get_min_clock(host);
...
}static const unsigned freqs[] = { 400000, 300000, 200000, 100000 }; void
mmc_rescan(struct work_struct *work)
{
...
for (i = 0; i <ARRAY_SIZE(freqs); i++) {
unsigned int freq = freqs[i];
if (freq >host->f_max) {
if (i + 1 <ARRAY_SIZE(freqs))
continue;
freq =host->f_max;
}
if (!mmc_rescan_try_freq(host,max(freq, host->f_min))) break;
if (freqs[i] <=host->f_min) // If you start at 100K, you will try 400K, 300K, 200K, 100K.
break;
}
...
}
Quoted 3 lines
Our controller supports 100K. During the test, it was found that
mmc_rescanfailed to scan the card at 400K, and did not try 300K, 200K, and 100K. After modifying the minimum clock limit to 100K, the card scan was successful.
Please add those last 3 lines to the commit message, then you can add:
Also please consider adding a Fixes: tag.
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Signed-off-by Wenchao Chen <[email protected]>--- drivers/mmc/host/sdhci-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/host/sdhci-sprd.c +1
-1@@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_clock(struct sdhci_host *host)static unsigned int sdhci_sprd_get_min_clock (struct sdhci_host *host) { -return 400000 ; +return 100000 ; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host,