public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: move host->data_offset init earlier
@ 2013-03-12 10:43 James Hogan
  2013-03-13  6:53 ` Jaehoon Chung
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: James Hogan @ 2013-03-12 10:43 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-kernel, James Hogan, Seungwon Jeon, Jaehoon Chung,
	Chris Ball

host->data_offset is initialised at the end of the probe function
depending on the VERID register, and is used for PIO operations. Move
this initialisation earlier, before IRQs or slots are initialised, to be
sure that PIO won't occur prior to host->data_offset being initialised.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Seungwon Jeon <tgih.jun@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Chris Ball <cjb@laptop.org>
---
Note, I didn't actually observe this problem occuring, but I think in
theory it could happen.

 drivers/mmc/host/dw_mmc.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 1a42c7c..7556456 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2289,6 +2289,18 @@ int dw_mci_probe(struct dw_mci *host)
 	mci_writel(host, CLKENA, 0);
 	mci_writel(host, CLKSRC, 0);
 
+	/*
+	 * In 2.40a spec, Data offset is changed.
+	 * Need to check the version-id and set data-offset for DATA register.
+	 */
+	host->verid = SDMMC_GET_VERID(mci_readl(host, VERID));
+	dev_info(host->dev, "Version ID is %04x\n", host->verid);
+
+	if (host->verid < DW_MMC_240A)
+		host->data_offset = DATA_OFFSET;
+	else
+		host->data_offset = DATA_240A_OFFSET;
+
 	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
 	host->card_workqueue = alloc_workqueue("dw-mci-card",
 			WQ_MEM_RECLAIM | WQ_NON_REENTRANT, 1);
@@ -2337,18 +2349,6 @@ int dw_mci_probe(struct dw_mci *host)
 		goto err_workqueue;
 	}
 
-	/*
-	 * In 2.40a spec, Data offset is changed.
-	 * Need to check the version-id and set data-offset for DATA register.
-	 */
-	host->verid = SDMMC_GET_VERID(mci_readl(host, VERID));
-	dev_info(host->dev, "Version ID is %04x\n", host->verid);
-
-	if (host->verid < DW_MMC_240A)
-		host->data_offset = DATA_OFFSET;
-	else
-		host->data_offset = DATA_240A_OFFSET;
-
 	if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO)
 		dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-22 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12 10:43 [PATCH] mmc: dw_mmc: move host->data_offset init earlier James Hogan
2013-03-13  6:53 ` Jaehoon Chung
2013-03-13 14:20 ` Seungwon Jeon
2013-03-22 16:45 ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox