ramips: fix cd-poll sd card remove randomly

Fix when add 'mediatek,cd-poll' to dts cause the sd card be removed randomly.
Special for the device without card-detect pin.

Signed-off-by: Qin Wie <me@vonger.cn>
This commit is contained in:
Qin Wie 2017-08-01 14:26:49 +08:00 committed by John Crispin
parent c31f0421ce
commit de350550ef
1 changed files with 4 additions and 0 deletions

View File

@ -2345,6 +2345,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ else
+ inserted = (status & MSDC_PS_CDSTS) ? 1 : 0;
+ }
+ if (host->mmc->caps & MMC_CAP_NEEDS_POLL)
+ inserted = 1;
+
+#if 0
+ change = host->card_inserted ^ inserted;
@ -4092,6 +4094,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1;
+ else
+ present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 1 : 0;
+ if (host->mmc->caps & MMC_CAP_NEEDS_POLL)
+ present = 1;
+ host->card_inserted = present;
+#endif
+ spin_unlock_irqrestore(&host->lock, flags);