Skip to content

Commit dbdea70

Browse files
ehristevstorulf
authored andcommitted
mmc: sdhci-of-at91: fix CALCR register being rewritten
When enabling calibration at reset, the CALCR register was completely rewritten. This may cause certain bits being deleted unintentedly. Fix by issuing a read-modify-write operation. Fixes: 727d836 ("mmc: sdhci-of-at91: add DT property to enable calibration on full reset") Signed-off-by: Eugen Hristev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 16e40e5 commit dbdea70

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/mmc/host/sdhci-of-at91.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
121121
|| mmc_gpio_get_cd(host->mmc) >= 0)
122122
sdhci_at91_set_force_card_detect(host);
123123

124-
if (priv->cal_always_on && (mask & SDHCI_RESET_ALL))
125-
sdhci_writel(host, SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
124+
if (priv->cal_always_on && (mask & SDHCI_RESET_ALL)) {
125+
u32 calcr = sdhci_readl(host, SDMMC_CALCR);
126+
127+
sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
126128
SDMMC_CALCR);
129+
}
127130
}
128131

129132
static const struct sdhci_ops sdhci_at91_sama5d2_ops = {

0 commit comments

Comments
 (0)