[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <AD8E15FA-A476-4275-A750-5EB587A93CEC@niasdigital.com>
Date: Sun, 3 Jan 2010 09:23:30 +1100
From: Ben Nizette <bn@...sdigital.com>
To: Pierre Ossman <pierre@...man.eu>
Cc: Hein_Tibosch <hein_tibosch@...oo.es>,
Sascha Hauer <s.hauer@...gutronix.de>,
Adrian Hunter <adrian.hunter@...ia.com>,
linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
Matt Fleming <matt@...sole-pimps.org>
Subject: [PATCH v3] mmc: Make ID freq configurable
On 02/01/2010, at 11:08 PM, Pierre Ossman wrote:
> On Sat, 2 Jan 2010 20:07:01 +1100
> Ben Nizette <bn@...sdigital.com> wrote:
>
>>
>> Pierre, thoughts? All my cards were borderline spec but Hein's got a mainstream, common card which seems to completely ignore the spec. Can we just take the few-hundred-uS hit and allow initialization down at the bottom end, say 100kHz?
>>
>
> Broken cards seem to be all over the spectrum, so I wouldn't be
> suprised if you find ones that break if you go too low as well.
Yea good point, though given there might not even be a One Freq to Rule Them All, how about:
---8<---
From: Ben Nizette <bn@...sdigital.com>
Subject: [PATCH v3] mmc: Make ID freq configurable
While the SD spec specifies a range of frequencies for the ID phase from 100-400kHz, not all cards play by the rules. This patch adds a Kconfig option to allow the user to tweak this to their card/host config, though the default of 250kHz should be fine for all spec-abiding cards and most others besides.
Signed-off-by: Ben Nizette <bn@...sdigital.com>
---
diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig
index ab37a6d..a8e5003 100644
--- a/drivers/mmc/core/Kconfig
+++ b/drivers/mmc/core/Kconfig
@@ -14,3 +14,15 @@ config MMC_UNSAFE_RESUME
This option is usually just for embedded systems which use
a MMC/SD card for rootfs. Most people should say N here.
+config MMC_ID_FREQ
+ int "SD/MMC Card initialisation frequency (Hz)"
+ default 250000
+ help
+ The SD card specification allows for initialisation
+ frequencies from 100-400kHz however some broken cards are
+ known not to work across this whole range.
+
+ If you're having problems with a particular card not being
+ detected, you may try adjusting this frequency up or down
+ but for widest compatibility just leave it default.
+
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7dab2e5..2eab68f 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -891,12 +891,17 @@ static void mmc_power_up(struct mmc_host *host)
*/
mmc_delay(10);
- if (host->f_min > 400000) {
- pr_warning("%s: Minimum clock frequency too high for "
- "identification mode\n", mmc_hostname(host));
+ /*
+ * CONFIG_MMC_ID_FREQ defaults to 250kHz which should be fine
+ * for most card/host combos.
+ */
+ if (host->f_min > CONFIG_MMC_ID_FREQ) {
+ pr_warning("%s: The host cannot reach the requested ID clock "
+ "rate, identification may fail\n",
+ mmc_hostname(host));
host->ios.clock = host->f_min;
} else
- host->ios.clock = 400000;
+ host->ios.clock = CONFIG_MMC_ID_FREQ;
host->ios.power_mode = MMC_POWER_ON;
mmc_set_ios(host);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists