mmc: mxs: fix card detection in case of 'broken-cd' flag set
Subsystems (2)
PATCH 1/1 mmc: mxs: fix card detection in case of 'broken-cd' flag set
In case of reboot my olinuxino imx23 board does not see mmc card any more. mmc_rescan is being called by delayed work in loop, but mxs_mmc_get_cd always returns 0, so we will never pass the card detection check and will not do further card inition.
This patch is just an attempt to partially revert the patch a91fe279ae of Sascha Hauer, where it is claimed that upper layer will handle broken card detection using the polling logic and MMC_CAP_NEEDS_POLL capability, but seems it is not true, because upper logic still expects 1 from 'get_cd'.
So, here we always return 1 (card present) in case of MMC_CAP_NEEDS_POLL capability set.
--- drivers/mmc/host/mxs-mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/mxs-mmc.c +2 -1
@@ -82,7 +82,8 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)if (ret >=0 )return ret; - present = !(readl (ssp->base +HW_SSP_STATUS (ssp)) & + present = mmc->caps &MMC_CAP_NEEDS_POLL || + !(readl (ssp->base +HW_SSP_STATUS (ssp)) &BM_SSP_STATUS_CARD_DETECT );if (mmc->caps2 &MMC_CAP2_CD_ACTIVE_HIGH )
Signature · 1 line
1.9.1
Quoted 15 lines · Roman Pen
In case of reboot my olinuxino imx23 board does not see mmc card any more.
mmc_rescanis being called by delayed work in loop, butmxs_mmc_get_cdalways returns 0, so we will never pass the card detection check and will not do further card inition.This patch is just an attempt to partially revert the patch
a91fe279aeof Sascha Hauer, where it is claimed that upper layer will handle broken card detection using the polling logic andMMC_CAP_NEEDS_POLLcapability, but seems it is not true, because upper logic still expects 1 from 'get_cd'.So, here we always return 1 (card present) in case of
MMC_CAP_NEEDS_POLLcapability set.
Quoted 8 lines
Signed-off-by Roman Pen <[email protected]>CC Chris Ball <[email protected]>CC Sascha Hauer <[email protected]>CC Fabio Estevam <[email protected]>CC Shawn Guo <[email protected]>CC Ulf Hansson <[email protected]>
I still didn't find the time to take a proper look at it. Since this fixes a bug for you:
Sascha
Quoted 22 lines
--- drivers/mmc/host/mxs-mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/host/mxs-mmc.c +2
-1@@ -82,7 +82,8 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)if (ret >=0 )return ret; - present = !(readl (ssp->base +HW_SSP_STATUS (ssp)) & + present = mmc->caps &MMC_CAP_NEEDS_POLL || + !(readl (ssp->base +HW_SSP_STATUS (ssp)) &BM_SSP_STATUS_CARD_DETECT );if (mmc->caps2 &MMC_CAP2_CD_ACTIVE_HIGH )Signature · 1 line
1.9.1
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Ulf Hansson
AppliedQuoted 15 lines · Roman Pen
In case of reboot my olinuxino imx23 board does not see mmc card any more.
mmc_rescanis being called by delayed work in loop, butmxs_mmc_get_cdalways returns 0, so we will never pass the card detection check and will not do further card inition.This patch is just an attempt to partially revert the patch
a91fe279aeof Sascha Hauer, where it is claimed that upper layer will handle broken card detection using the polling logic andMMC_CAP_NEEDS_POLLcapability, but seems it is not true, because upper logic still expects 1 from 'get_cd'.So, here we always return 1 (card present) in case of
MMC_CAP_NEEDS_POLLcapability set.
Quoted 8 lines
Signed-off-by Roman Pen <[email protected]>CC Chris Ball <[email protected]>CC Sascha Hauer <[email protected]>CC Fabio Estevam <[email protected]>CC Shawn Guo <[email protected]>CC Ulf Hansson <[email protected]>
Thanks! Applied for next.
Kind regards
Uffe
Quoted 21 lines
--- drivers/mmc/host/mxs-mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/host/mxs-mmc.c +2
-2@@ -82,7 +82,8 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)if (ret >=0 )return ret; - present = !(readl (ssp->base +HW_SSP_STATUS (ssp)) & + present = mmc->caps &MMC_CAP_NEEDS_POLL || + !(readl (ssp->base +HW_SSP_STATUS (ssp)) &BM_SSP_STATUS_CARD_DETECT );if (mmc->caps2 &MMC_CAP2_CD_ACTIVE_HIGH ) --1.9.1