[PATCH] sdhci: support setting f_max clock via call back

Philip Rakity prakity at marvell.com
Tue Dec 14 19:56:41 EST 2010


need ability to set f_max independent of max_clk.

setting max_clk does not work since our clock speed is fixed.
adjusting max_clk lower just messes up the clock dividers.

Signed-off-by: Philip Rakity <prakity at marvell.com>
---
 drivers/mmc/host/sdhci.c |    8 +++++++-
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f439881..6486009 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1884,7 +1884,13 @@ int sdhci_add_host(struct sdhci_host *host)
 	else
 		mmc->f_min =3D host->max_clk / SDHCI_MAX_DIV_SPEC_200;
=20
-	mmc->f_max =3D host->max_clk;
+	if (host->ops->get_f_max_clock) {
+		mmc->f_max =3D host->ops->get_f_max_clock(host);
+		if (mmc->f_max > host->max_clk)
+			mmc->f_max =3D host->max_clk;
+	} else
+		mmc->f_max =3D host->max_clk;
+
 	mmc->caps |=3D MMC_CAP_SDIO_IRQ;
=20
 	/*
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 9dd7bc1..a8c43c9 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -224,6 +224,7 @@ struct sdhci_ops {
 	unsigned int    (*get_ro)(struct sdhci_host *host);
 	void	(*platform_reset_enter)(struct sdhci_host *host, u8 mask);
 	void	(*platform_reset_exit)(struct sdhci_host *host, u8 mask);
+	unsigned int	(*get_f_max_clock)(struct sdhci_host *host);
 };
=20
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--=20
1.6.0.4

--_002_3DA195EF0D314C76BB61B52BAE9D9689marvellcom_
Content-Type: application/octet-stream;
	name="0008-sdhci-support-setting-f_max-clock-via-call-back.patch"
Content-Description: 0008-sdhci-support-setting-f_max-clock-via-call-back.patch
Content-Disposition: attachment;
	filename="0008-sdhci-support-setting-f_max-clock-via-call-back.patch";
	size=1626; creation-date="Tue, 21 Dec 2010 23:08:45 GMT";
	modification-date="Tue, 21 Dec 2010 23:08:45 GMT"
Content-Transfer-Encoding: base64

RnJvbSBhYjVjZmI4OGFhYjYzM2VmNDQ4NzQ5NTMxYTBiOWRkYjk5YTRlZTFmIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXAgUmFraXR5IDxwcmFraXR5QG1hcnZlbGwuY29tPgpE
YXRlOiBUdWUsIDE0IERlYyAyMDEwIDE2OjU2OjQxIC0wODAwClN1YmplY3Q6IFtQQVRDSF0gc2Ro
Y2k6IHN1cHBvcnQgc2V0dGluZyBmX21heCBjbG9jayB2aWEgY2FsbCBiYWNrCgpuZWVkIGFiaWxp
dHkgdG8gc2V0IGZfbWF4IGluZGVwZW5kZW50IG9mIG1heF9jbGsuCgpzZXR0aW5nIG1heF9jbGsg
ZG9lcyBub3Qgd29yayBzaW5jZSBvdXIgY2xvY2sgc3BlZWQgaXMgZml4ZWQuCmFkanVzdGluZyBt
YXhfY2xrIGxvd2VyIGp1c3QgbWVzc2VzIHVwIHRoZSBjbG9jayBkaXZpZGVycy4KClNpZ25lZC1v
ZmYtYnk6IFBoaWxpcCBSYWtpdHkgPHByYWtpdHlAbWFydmVsbC5jb20+Ci0tLQogZHJpdmVycy9t
bWMvaG9zdC9zZGhjaS5jIHwgICAgOCArKysrKysrLQogZHJpdmVycy9tbWMvaG9zdC9zZGhjaS5o
IHwgICAgMSArCiAyIGZpbGVzIGNoYW5nZWQsIDggaW5zZXJ0aW9ucygrKSwgMSBkZWxldGlvbnMo
LSkKCmRpZmYgLS1naXQgYS9kcml2ZXJzL21tYy9ob3N0L3NkaGNpLmMgYi9kcml2ZXJzL21tYy9o
b3N0L3NkaGNpLmMKaW5kZXggZjQzOTg4MS4uNjQ4NjAwOSAxMDA2NDQKLS0tIGEvZHJpdmVycy9t
bWMvaG9zdC9zZG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