Andy Green wrote:
> This sounds like a good thing to have anyway based on the Glamo MCI
> experience, it wouldn't work reliably above 16MHz and this one is at
> 50MHz (although Glamo had series resistors). Maybe you could rebase
> your patch on stable-tracking and we should take it anyway.
I've rebased it (hah, you already merged the SDIO stack switch !)
and cleaned it up a little. The main change is that picking a
value < f_min now sets the frequency to f_min instead of ignoring
the option.
- Werner
debug-s3cmci-fmax.patch
This patch adds the module parameter f_max to s3cmci to limit the
maximum clock frequency of the SD interface.
E.g., when booting with s3cmci.f_max=10000000, the kernel should say
s3c2440-sdi s3c2440-sdi: f_max lowered from 50000000 to 10000000 Hz
and the interface frequency should be limited accordingly.
Setting the limit above the maximum frequency supported by the card
or the interface has no effect, so the option is ignored (and no
"f_max lowered" line is printed).
Setting the limit below the minimum frequency supported by the
interface sets it to that frequency.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
Index: ktrack/drivers/mmc/host/s3cmci.c
===================================================================
--- ktrack.orig/drivers/mmc/host/s3cmci.c 2008-11-17 06:27:20.000000000 -0200
+++ ktrack/drivers/mmc/host/s3cmci.c 2008-11-17 07:10:19.000000000 -0200
@@ -56,6 +56,8 @@
static const int dbgmap_info = dbg_info | dbg_conf;
static const int dbgmap_debug = dbg_err | dbg_debug;
+static int f_max = -1; /* override maximum frequency limit */
+
#define dbg(host, channels, args...) \
do { \
if (dbgmap_err & channels) \
@@ -1394,6 +1396,18 @@
mmc->f_min = host->clk_rate / (host->clk_div * 256);
mmc->f_max = host->clk_rate / host->clk_div;
+ if (f_max >= 0) {
+ unsigned f = f_max;
+
+ if (f < mmc->f_min)
+ f = mmc->f_min;
+ if (mmc->f_max > f) {
+ dev_info(&pdev->dev, "f_max lowered from %u to %u Hz\n",
+ mmc->f_max, f);
+ mmc->f_max = f;
+ }
+ }
+
if (host->pdata->ocr_avail)
mmc->ocr_avail = host->pdata->ocr_avail;
@@ -1575,6 +1589,8 @@
module_init(s3cmci_init);
module_exit(s3cmci_exit);
+module_param(f_max, int, 0644)
+
MODULE_DESCRIPTION("Samsung S3C MMC/SD Card Interface driver");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Thomas Kleffel <[EMAIL PROTECTED]>, Ben Dooks <[EMAIL PROTECTED]>");