[PATCH] sdhci: support hardware clock gating in the SD layer

Philip Rakity prakity at marvell.com
Tue Dec 21 00:47:37 EST 2010


Define callback (platform_hw_clk_gate) that is called when H/W clock gating
is defined. The adaptation layer is responsible for enabling hw clock
gating by:

a) setting mmc->caps |=3D MMC_CAP_HW_CLOCK_GATING to enable h/w gating
b) defining the callback.

Signed-off-by: Philip Rakity <prakity at marvell.com>
Signed-off-by: Mark F. Brown <markb at marvell.com>
Tested-by: Philip Rakity <prakity at marvell.com>
---
 drivers/mmc/host/sdhci.c |    6 ++++++
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ff9d5f0..dcfbe83 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1203,6 +1203,12 @@ static void sdhci_set_ios(struct mmc_host *mmc, stru=
ct mmc_ios *ios)
 	if (host->ops->platform_send_init_74_clocks)
 		host->ops->platform_send_init_74_clocks(host, ios->power_mode);
=20
+#ifdef CONFIG_MMC_CLKGATE
+	if ((mmc->caps & MMC_CAP_HW_CLOCK_GATING)
+		&& host->ops->platform_hw_clk_gate)
+			host->ops->platform_hw_clk_gate(host);
+#endif
+
 	/*
 	 * If your platform has 8-bit width support but is not a v3 controller,
 	 * or if it requires special setup code, you should implement that in
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 84292e0..cbd63e2 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -241,6 +241,7 @@ struct sdhci_ops {
 	void	(*platform_reset_exit)(struct sdhci_host *host, u8 mask);
 	unsigned int	(*get_f_max_clock)(struct sdhci_host *host);
 	void	(*platform_specific_delay)(struct sdhci_host *host);
+	void	(*platform_hw_clk_gate)(struct sdhci_host *host);
 };
=20
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--=20
1.6.0.4

--_002_744F5B54A6874BF09F41A7DE470CB48Bmarvellcom_
Content-Type: application/octet-stream;
	name="0020-sdhci-support-hardware-clock-gating-in-the-SD-layer.patch"
Content-Description: 0020-sdhci-support-hardware-clock-gating-in-the-SD-layer.patch
Content-Disposition: attachment;
	filename="0020-sdhci-support-hardware-clock-gating-in-the-SD-layer.patch";
	size=1927; creation-date="Tue, 21 Dec 2010 23:11:00 GMT";
	modification-date="Tue, 21 Dec 2010 23:11:00 GMT"
Content-Transfer-Encoding: base64

RnJvbSA1OTBlYjJjYzA1MjMzMGI3YTRmNjhmYjJkZjYyNTVkNjVlMjQ5ZTFkIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXAgUmFraXR5IDxwcmFraXR5QG1hcnZlbGwuY29tPgpE
YXRlOiBNb24sIDIwIERlYyAyMDEwIDIxOjQ3OjM3IC0wODAwClN1YmplY3Q6IFtQQVRDSF0gc2Ro
Y2k6IHN1cHBvcnQgaGFyZHdhcmUgY2xvY2sgZ2F0aW5nIGluIHRoZSBTRCBsYXllcgoKRGVmaW5l
IGNhbGxiYWNrIChwbGF0Zm9ybV9od19jbGtfZ2F0ZSkgdGhhdCBpcyBjYWxsZWQgd2hlbiBIL1cg
Y2xvY2sgZ2F0aW5nCmlzIGRlZmluZWQuIFRoZSBhZGFwdGF0aW9uIGxheWVyIGlzIHJlc3BvbnNp
YmxlIGZvciBlbmFibGluZyBodyBjbG9jawpnYXRpbmcgYnk6CgphKSBzZXR0aW5nIG1tYy0+Y2Fw
cyB8PSBNTUNfQ0FQX0hXX0NMT0NLX0dBVElORyB0byBlbmFibGUgaC93IGdhdGluZwpiKSBkZWZp
bmluZyB0aGUgY2FsbGJhY2suCgpTaWduZWQtb2ZmLWJ5OiBQaGlsaXAgUmFraXR5IDxwcmFraXR5
QG1hcnZlbGwuY29tPgpTaWduZWQtb2ZmLWJ5OiBNYXJrIEYuIEJyb3duIDxtYXJrYkBtYXJ2ZWxs
LmNvbT4KVGVzdGVkL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