msm: sdio: read the HW mailbox in sdio_close flush procedure
In the sdio_close flush procedure we need to make sure read_mailbox
is done to verify that the rx bytes avail were updated, before we can
complete the flush.
In case the apps is loaded, we cannot assume that read_mailbox was done
during the wait time and we need to explicitly call read_mailbox.
Signed-off-by: Maya Erez <merez@codeaurora.org>
diff --git a/arch/arm/mach-msm/sdio_al.c b/arch/arm/mach-msm/sdio_al.c
index 714a61b..69521c7 100644
--- a/arch/arm/mach-msm/sdio_al.c
+++ b/arch/arm/mach-msm/sdio_al.c
@@ -2671,6 +2671,17 @@
" 0x%x\n", __func__, ch->signature);
return -ENODEV;
}
+ if (sdio_al_verify_dev(ch->sdio_al_dev, __func__))
+ return -ENODEV;
+ sdio_claim_host(sdio_al_dev->card->sdio_func[0]);
+ ret = read_mailbox(sdio_al_dev, false);
+ if (ret) {
+ pr_err(MODULE_NAME ":%s: failed to read mailbox",
+ __func__);
+ sdio_release_host(sdio_al_dev->card->sdio_func[0]);
+ return -ENODEV;
+ }
+ sdio_release_host(sdio_al_dev->card->sdio_func[0]);
} while (ch->read_avail > 0);
sdio_claim_host(sdio_al_dev->card->sdio_func[0]);