diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-03-16 17:13:59 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2009-03-24 16:30:09 -0400 |
commit | 8114634ccb54d67a8c01e5825d95bff4e7f7b357 (patch) | |
tree | e80edf6881a8366fadbd4ec06574af8ab6306c24 /drivers/mmc/host | |
parent | 4240ff0a02cb52f7d10dc1df6d82ba9c27dba07b (diff) |
sdhci: Add set_clock callback and a quirk for nonstandard clocks
FSL eSDHC hosts have incompatible register map to manage the SDCLK.
This patch adds set_clock callback so that drivers could overwrite
set_clock behaviour.
Similar patch[1] was posted by Ben Dooks, though in Ben's version the
callback is named change_clock, plus the patch has some unrelated bits
that makes the patch difficult to reuse.
[1] http://lkml.org/lkml/2008/12/2/160
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 6 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 34ab77bd12ae..75d0ecbce10c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -949,6 +949,12 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) | |||
949 | if (clock == host->clock) | 949 | if (clock == host->clock) |
950 | return; | 950 | return; |
951 | 951 | ||
952 | if (host->ops->set_clock) { | ||
953 | host->ops->set_clock(host, clock); | ||
954 | if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK) | ||
955 | return; | ||
956 | } | ||
957 | |||
952 | sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); | 958 | sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); |
953 | 959 | ||
954 | if (clock == 0) | 960 | if (clock == 0) |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index aab0652a4585..b9bc622735ba 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -218,6 +218,8 @@ struct sdhci_host { | |||
218 | #define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) | 218 | #define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) |
219 | /* Controller reports inverted write-protect state */ | 219 | /* Controller reports inverted write-protect state */ |
220 | #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) | 220 | #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) |
221 | /* Controller has nonstandard clock management */ | ||
222 | #define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17) | ||
221 | 223 | ||
222 | int irq; /* Device IRQ */ | 224 | int irq; /* Device IRQ */ |
223 | void __iomem * ioaddr; /* Mapped address */ | 225 | void __iomem * ioaddr; /* Mapped address */ |
@@ -284,6 +286,8 @@ struct sdhci_ops { | |||
284 | void (*writeb)(struct sdhci_host *host, u8 val, int reg); | 286 | void (*writeb)(struct sdhci_host *host, u8 val, int reg); |
285 | #endif | 287 | #endif |
286 | 288 | ||
289 | void (*set_clock)(struct sdhci_host *host, unsigned int clock); | ||
290 | |||
287 | int (*enable_dma)(struct sdhci_host *host); | 291 | int (*enable_dma)(struct sdhci_host *host); |
288 | unsigned int (*get_max_clock)(struct sdhci_host *host); | 292 | unsigned int (*get_max_clock)(struct sdhci_host *host); |
289 | unsigned int (*get_timeout_clock)(struct sdhci_host *host); | 293 | unsigned int (*get_timeout_clock)(struct sdhci_host *host); |