diff options
author | Andy Green <andy@openmoko.com> | 2008-11-19 17:09:58 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:58 +0000 |
commit | cb559a9ddbd67883ec2e328ed69f9ad68768b4de (patch) | |
tree | a450747f6af28941c8419563566ab76738eb6bf9 /drivers/mfd/glamo/glamo-mci.c | |
parent | 3965859d32cbe5e29c1f99b417feeb9e6d02f7d8 (diff) |
add-glamo-mci-slower-clocking-dynamic-switching.patch
This patch gives glamo-mci a concept of a platform-defined
dynamic clock slowing callback. It means that platform code
can associate some completely external state to decide if
we run the SD clock at normal rate or a rate divided by a
module parameter "sd_slow_ratio", which you can set on
kernel commandline like this:
glamo_mci.sd_slow_ratio=8
you can also change it at runtime by
echo 8 > /sys/module/glamo_mci/parameters/sd_slow_ratio
If no platform callback is defined, then no slow mode
is used. If it is defined, then the default division
action is / 8, eg, 16MHz normal -> 2MHz slow mode.
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/mfd/glamo/glamo-mci.c')
-rw-r--r-- | drivers/mfd/glamo/glamo-mci.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c index 7a2b060b3a7..d34632a8d18 100644 --- a/drivers/mfd/glamo/glamo-mci.c +++ b/drivers/mfd/glamo/glamo-mci.c @@ -57,6 +57,23 @@ static int sd_max_clk = 50000000 / 3; module_param(sd_max_clk, int, 0644); /* + * Slow SD clock rate + * + * you can override this on kernel commandline using + * + * glamo_mci.sd_slow_ratio=8 + * + * for example + * + * platform callback is used to decide effective clock rate, if not + * defined then max is used, if defined and returns nonzero, rate is + * divided by this factor + */ + +static int sd_slow_ratio = 8; +module_param(sd_slow_ratio, int, 0644); + +/* * SD Signal drive strength * * you can override this on kernel commandline using @@ -554,8 +571,17 @@ static void glamo_mci_send_request(struct mmc_host *mmc) cmd->opcode, cmd->arg, cmd->data, cmd->mrq->stop, cmd->flags); - /* resume requested clock rate */ - __glamo_mci_fix_card_div(host, host->clk_div); + /* resume requested clock rate + * scale it down by sd_slow_ratio if platform requests it + */ + if (host->pdata->glamo_mci_use_slow) + if ((host->pdata->glamo_mci_use_slow)()) + __glamo_mci_fix_card_div(host, host->clk_div * + sd_slow_ratio); + else + __glamo_mci_fix_card_div(host, host->clk_div); + else + __glamo_mci_fix_card_div(host, host->clk_div); if (glamo_mci_send_command(host, cmd)) goto bail; |