Skip to content

Commit 855d388

Browse files
wenbinmei1Ulf Hansson
authored andcommitted
mmc: mediatek: add optional module reset property
This patch fixs eMMC-Access on mt7622/Bpi-64. Before we got these Errors on mounting eMMC ion R64: [ 48.664925] blk_update_request: I/O error, dev mmcblk0, sector 204800 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0 [ 48.676019] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write This patch adds a optional reset management for msdc. Sometimes the bootloader does not bring msdc register to default state, so need reset the msdc controller. Cc: <stable@vger.kernel.org> # v5.4+ Fixes: 966580a ("mmc: mediatek: add support for MT7622 SoC") Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Tested-by: Frank Wunderlich <frank-w@public-files.de> Link: https://lore.kernel.org/r/20200814014346.6496-4-wenbin.mei@mediatek.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 6555738 commit 855d388

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/mmc/host/mtk-sd.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/slab.h>
2323
#include <linux/spinlock.h>
2424
#include <linux/interrupt.h>
25+
#include <linux/reset.h>
2526

2627
#include <linux/mmc/card.h>
2728
#include <linux/mmc/core.h>
@@ -419,6 +420,7 @@ struct msdc_host {
419420
struct pinctrl_state *pins_uhs;
420421
struct delayed_work req_timeout;
421422
int irq; /* host interrupt */
423+
struct reset_control *reset;
422424

423425
struct clk *src_clk; /* msdc source clock */
424426
struct clk *h_clk; /* msdc h_clk */
@@ -1592,6 +1594,12 @@ static void msdc_init_hw(struct msdc_host *host)
15921594
u32 val;
15931595
u32 tune_reg = host->dev_comp->pad_tune_reg;
15941596

1597+
if (host->reset) {
1598+
reset_control_assert(host->reset);
1599+
usleep_range(10, 50);
1600+
reset_control_deassert(host->reset);
1601+
}
1602+
15951603
/* Configure to MMC/SD mode, clock free running */
15961604
sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN);
15971605

@@ -2390,6 +2398,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
23902398
if (IS_ERR(host->src_clk_cg))
23912399
host->src_clk_cg = NULL;
23922400

2401+
host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
2402+
"hrst");
2403+
if (IS_ERR(host->reset))
2404+
return PTR_ERR(host->reset);
2405+
23932406
host->irq = platform_get_irq(pdev, 0);
23942407
if (host->irq < 0) {
23952408
ret = -EINVAL;

0 commit comments

Comments
 (0)