diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index 0b56d1405bee..30083cf6f4e5 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -688,6 +688,18 @@ static int sunxi_mmc_probe(struct udevice *dev) writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl); udelay(1000); + /* Reset card */ + writel(0, &priv->reg->hwrst); + udelay(10); + writel(1, &priv->reg->hwrst); + udelay(300); + + writel((0xffffffU << 8) | 0xff, &priv->reg->timeout); + + writel((512 << 16) | (1U << 2) | (1U << 0), &priv->reg->thldc); + writel(3, &priv->reg->csdc); + writel(0xdeb, &priv->reg->dbgc); + return 0; } diff --git a/drivers/mmc/sunxi_mmc.h b/drivers/mmc/sunxi_mmc.h index f4ae5a790c87..238a8210c764 100644 --- a/drivers/mmc/sunxi_mmc.h +++ b/drivers/mmc/sunxi_mmc.h @@ -34,10 +34,12 @@ struct sunxi_mmc { u32 cbcr; /* 0x48 CIU byte count */ u32 bbcr; /* 0x4c BIU byte count */ u32 dbgc; /* 0x50 debug enable */ - u32 res0; /* 0x54 reserved */ + u32 csdc; /* 0x54 CRC status detect */ u32 a12a; /* 0x58 Auto command 12 argument */ u32 ntsr; /* 0x5c New timing set register */ - u32 res1[8]; + u32 res1[6]; + u32 hwrst; /* 0x78 Hardware Reset */ + u32 res5; u32 dmac; /* 0x80 internal DMA control */ u32 dlba; /* 0x84 internal DMA descr list base address */ u32 idst; /* 0x88 internal DMA status */ @@ -46,7 +48,8 @@ struct sunxi_mmc { u32 cbda; /* 0x94 */ u32 res2[26]; #if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) || defined(CONFIG_SUNXI_GEN_NCAT2) - u32 res3[17]; + u32 thldc; /* 0x100 Threshold control */ + u32 res3[16]; u32 samp_dl; u32 res4[46]; #endif