[PATCH 10/14] atmel_mci: after a software timeout the IP need to be reset

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Jan 25 10:17:43 EST 2013


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 drivers/mci/atmel_mci.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index 1b60348..53df2e3 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -48,6 +48,7 @@ struct atmel_mci {
 
 	unsigned long		bus_hz;
 	u32			mode_reg;
+	bool			need_reset;
 };
 
 #define to_mci_host(mci)	container_of(mci, struct atmel_mci, mci)
@@ -118,6 +119,7 @@ static int atmci_poll_status(struct atmel_mci *host, u32 mask)
 			return stat;
 		if (is_timeout(start, SECOND)) {
 			dev_err(host->hw_dev, "timeout\n");
+			host->need_reset = true;
 			return ATMCI_RTOE | stat;
 		}
 		if (stat & mask)
@@ -412,10 +414,11 @@ static int atmci_request(struct mci_host *mci, struct mci_cmd *cmd, struct mci_d
 	u32 stat, cmdat = 0;
 	int ret;
 
-	if (host->caps.need_reset_after_xfer) {
+	if (host->need_reset || host->caps.need_reset_after_xfer) {
 		atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
 		atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
 		atmci_writel(host, ATMCI_MR, host->mode_reg);
+		host->need_reset = false;
 	}
 
 	if (cmd->resp_type != MMC_RSP_NONE)
-- 
1.7.10.4




More information about the barebox mailing list