Skip to content

Commit 9e84a2e

Browse files
Faiz-Abbasstorulf
authored andcommitted
mmc: sdhci-omap: Add special reset capability
Some omap controllers need software to monitor a 0->1->0 for software reset. Add a SDHCI_OMAP_SPECIAL_RESET flag to indicate this. Signed-off-by: Faiz Abbas <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent d6fe492 commit 9e84a2e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/mmc/host/sdhci-omap.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686

8787
/* sdhci-omap controller flags */
8888
#define SDHCI_OMAP_REQUIRE_IODELAY BIT(0)
89+
#define SDHCI_OMAP_SPECIAL_RESET BIT(1)
8990

9091
struct sdhci_omap_data {
9192
u32 offset;
@@ -779,15 +780,35 @@ static void sdhci_omap_set_uhs_signaling(struct sdhci_host *host,
779780
sdhci_omap_start_clock(omap_host);
780781
}
781782

783+
#define MMC_TIMEOUT_US 20000 /* 20000 micro Sec */
782784
static void sdhci_omap_reset(struct sdhci_host *host, u8 mask)
783785
{
784786
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
785787
struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
788+
unsigned long limit = MMC_TIMEOUT_US;
789+
unsigned long i = 0;
786790

787791
/* Don't reset data lines during tuning operation */
788792
if (omap_host->is_tuning)
789793
mask &= ~SDHCI_RESET_DATA;
790794

795+
if (omap_host->flags & SDHCI_OMAP_SPECIAL_RESET) {
796+
sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
797+
while ((!(sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask)) &&
798+
(i++ < limit))
799+
udelay(1);
800+
i = 0;
801+
while ((sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) &&
802+
(i++ < limit))
803+
udelay(1);
804+
805+
if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask)
806+
dev_err(mmc_dev(host->mmc),
807+
"Timeout waiting on controller reset in %s\n",
808+
__func__);
809+
return;
810+
}
811+
791812
sdhci_reset(host, mask);
792813
}
793814

@@ -900,10 +921,12 @@ static const struct sdhci_omap_data k2g_data = {
900921

901922
static const struct sdhci_omap_data am335_data = {
902923
.offset = 0x200,
924+
.flags = SDHCI_OMAP_SPECIAL_RESET,
903925
};
904926

905927
static const struct sdhci_omap_data am437_data = {
906928
.offset = 0x200,
929+
.flags = SDHCI_OMAP_SPECIAL_RESET,
907930
};
908931

909932
static const struct sdhci_omap_data dra7_data = {

0 commit comments

Comments
 (0)