Skip to content

Commit 63ef5d8

Browse files
Jerry Huangcjb
authored andcommitted
mmc: sdhci-of-esdhc: disable CMD23 for some Freescale SoCs
CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported. Therefore, we'll not use CMD23. Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 00956ea commit 63ef5d8

5 files changed

Lines changed: 23 additions & 0 deletions

File tree

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ static void esdhc_of_resume(struct sdhci_host *host)
169169
}
170170
#endif
171171

172+
static void esdhc_of_platform_init(struct sdhci_host *host)
173+
{
174+
u32 vvn;
175+
176+
vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
177+
vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
178+
if (vvn == VENDOR_V_22)
179+
host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
180+
}
181+
172182
static struct sdhci_ops sdhci_esdhc_ops = {
173183
.read_l = esdhc_readl,
174184
.read_w = esdhc_readw,
@@ -180,6 +190,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
180190
.enable_dma = esdhc_of_enable_dma,
181191
.get_max_clock = esdhc_of_get_max_clock,
182192
.get_min_clock = esdhc_of_get_min_clock,
193+
.platform_init = esdhc_of_platform_init,
183194
#ifdef CONFIG_PM
184195
.platform_suspend = esdhc_of_suspend,
185196
.platform_resume = esdhc_of_resume,

drivers/mmc/host/sdhci-pltfm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
150150
goto err_remap;
151151
}
152152

153+
/*
154+
* Some platforms need to probe the controller to be able to
155+
* determine which caps should be used.
156+
*/
157+
if (host->ops && host->ops->platform_init)
158+
host->ops->platform_init(host);
159+
153160
platform_set_drvdata(pdev, host);
154161

155162
return host;

drivers/mmc/host/sdhci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,6 +2837,9 @@ int sdhci_add_host(struct sdhci_host *host)
28372837
if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
28382838
mmc->caps |= MMC_CAP_4_BIT_DATA;
28392839

2840+
if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
2841+
mmc->caps &= ~MMC_CAP_CMD23;
2842+
28402843
if (caps[0] & SDHCI_CAN_DO_HISPD)
28412844
mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
28422845

drivers/mmc/host/sdhci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ struct sdhci_ops {
278278
void (*hw_reset)(struct sdhci_host *host);
279279
void (*platform_suspend)(struct sdhci_host *host);
280280
void (*platform_resume)(struct sdhci_host *host);
281+
void (*platform_init)(struct sdhci_host *host);
281282
};
282283

283284
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS

include/linux/mmc/sdhci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct sdhci_host {
9191
unsigned int quirks2; /* More deviations from spec. */
9292

9393
#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
94+
#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
9495

9596
int irq; /* Device IRQ */
9697
void __iomem *ioaddr; /* Mapped address */

0 commit comments

Comments
 (0)