[PATCH] sdhci: add ops to force delay in operations due to silicon= issues

Philip Rakity prakity at marvell.com
Sun Dec 19 18:35:00 EST 2010


PXA168 controller needs at least 8 clocks before it can start the
next transaction.  When the bus speed is slow the CPU can get back
to the controller before the 8 clocks causing SD CRC errors.

Add a new host->op to call into platform specific code to delay
the operation until the time has expired

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

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6486009..ff9d5f0 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -922,6 +922,14 @@ static void sdhci_send_command(struct sdhci_host *host=
, struct mmc_command *cmd)
 		mdelay(1);
 	}
=20
+	/*
+	 * we cannot talk to controller for 8 bus cycles according to sdio spec
+	 * at lowest speed this is 100,000 HZ per cycle or 800,000 cycles
+	 * which is quite a LONG TIME on a fast cpu -- so delay if needed
+	 */
+	if (host->ops->platform_specific_delay)
+		host->ops->platform_specific_delay(host);
+
 	mod_timer(&host->timer, jiffies + 10 * HZ);
=20
 	host->cmd =3D cmd;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index a8c43c9..91749dc 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -225,6 +225,7 @@ struct sdhci_ops {
 	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);
+	void	(*platform_specific_delay)(struct sdhci_host *host);
 };
=20
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--=20
1.6.0.4

--_002_E9DF4A50CA7D4A92B912F399667CB7A0marvellcom_
Content-Type: application/octet-stream;
	name="0014-sdhci-add-ops-to-force-delay-in-operations-due-to-s.patch"
Content-Description: 0014-sdhci-add-ops-to-force-delay-in-operations-due-to-s.patch
Content-Disposition: attachment;
	filename="0014-sdhci-add-ops-to-force-delay-in-operations-due-to-s.patch";
	size=1879; creation-date="Tue, 21 Dec 2010 23:09:48 GMT";
	modification-date="Tue, 21 Dec 2010 23:09:48 GMT"
Content-Transfer-Encoding: base64

RnJvbSBkYmY4YzZkNDc1MmUwNzY2OTFjZjc1YjM5YTI0MmE2NDMwM2EzODNkIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXAgUmFraXR5IDxwcmFraXR5QG1hcnZlbGwuY29tPgpE
YXRlOiBTdW4sIDE5IERlYyAyMDEwIDE1OjM1OjAwIC0wODAwClN1YmplY3Q6IFtQQVRDSF0gc2Ro
Y2k6IGFkZCBvcHMgdG8gZm9yY2UgZGVsYXkgaW4gb3BlcmF0aW9ucyBkdWUgdG8gc2lsaWNvbiBp
c3N1ZXMKClBYQTE2OCBjb250cm9sbGVyIG5lZWRzIGF0IGxlYXN0IDggY2xvY2tzIGJlZm9yZSBp
dCBjYW4gc3RhcnQgdGhlCm5leHQgdHJhbnNhY3Rpb24uICBXaGVuIHRoZSBidXMgc3BlZWQgaXMg
c2xvdyB0aGUgQ1BVIGNhbiBnZXQgYmFjawp0byB0aGUgY29udHJvbGxlciBiZWZvcmUgdGhlIDgg
Y2xvY2tzIGNhdXNpbmcgU0QgQ1JDIGVycm9ycy4KCkFkZCBhIG5ldyBob3N0LT5vcCB0byBjYWxs
IGludG8gcGxhdGZvcm0gc3BlY2lmaWMgY29kZSB0byBkZWxheQp0aGUgb3BlcmF0aW9uIHVudGls
IHRoZSB0aW1lIGhhcyBleHBpcmVkCgpTaWduZWQtb2ZmLWJ5OiBQaGlsaXAgUmFraXR5IDxwcmFr
aXR5QG1hcnZlbGwuY29tPgotLS0KIGRyaXZlcnMvbW1jL2hvc3Qvc2RoY2kuYyB8ICAgIDggKysr
KysrKysKIGRyaXZlcnMvbW1jL2h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