Commit cddce28c8d7432ee8919a5589da93de8eb1bc396

Authored by Kishon Vijay Abraham I
Committed by Sekhar Nori
1 parent bda7692b62

mmc: host: omap_hsmmc: Fix DTO and DCRC handling

DTO/DCRC errors were not being informed to the mmc core since
commit ae4bf788ee ("mmc: omap_hsmmc: consolidate error report handling of
iHSMMC IRQ"). This commit made sure 'end_trans' is never set on DTO/DCRC
errors. This is because after this commit 'host->data' is checked after
it has been cleared to NULL by omap_hsmmc_dma_cleanup().

Because 'end_trans' is never set, omap_hsmmc_xfer_done() is never invoked
making core layer not to be aware of DTO/DCRC errors. Because of this
any command invoked after DTO/DCRC error leads to a hang.

Fix this by checking for 'host->data' before it is actually cleared.

Fixes: ae4bf788ee ("mmc: omap_hsmmc: consolidate error report handling of
iHSMMC IRQ")

Reported-by: Yan Liu <yan-liu@ti.com>
Tested-by: Yan Liu <yan-liu@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

drivers/mmc/host/omap_hsmmc.c
... ... @@ -1358,6 +1358,10 @@
1358 1358  
1359 1359 if (status & (CTO_EN | CCRC_EN))
1360 1360 end_cmd = 1;
  1361 + if (host->data || host->response_busy) {
  1362 + end_trans = !end_cmd;
  1363 + host->response_busy = 0;
  1364 + }
1361 1365 if (status & (CTO_EN | DTO_EN))
1362 1366 hsmmc_command_incomplete(host, -ETIMEDOUT, end_cmd);
1363 1367 else if (status & (CCRC_EN | DCRC_EN))
... ... @@ -1376,10 +1380,6 @@
1376 1380 hsmmc_command_incomplete(host, error, end_cmd);
1377 1381 }
1378 1382 dev_dbg(mmc_dev(host->mmc), "AC12 err: 0x%x\n", ac12);
1379   - }
1380   - if (host->data || host->response_busy) {
1381   - end_trans = !end_cmd;
1382   - host->response_busy = 0;
1383 1383 }
1384 1384 }
1385 1385