Skip to content

Commit e8a1ff6

Browse files
wenbinmei1storulf
authored andcommitted
mmc: mediatek: Move cqhci init behind ungate clock
We must enable clock before cqhci init, because crypto needs read information from CQHCI registers, otherwise, it will hang in MediaTek mmc host controller. Signed-off-by: Wenbin Mei <[email protected]> Fixes: 88bd652 ("mmc: mediatek: command queue support") Cc: [email protected] Acked-by: Chaotian Jing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 92b1825 commit e8a1ff6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

drivers/mmc/host/mtk-sd.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,6 +2577,25 @@ static int msdc_drv_probe(struct platform_device *pdev)
25772577
host->dma_mask = DMA_BIT_MASK(32);
25782578
mmc_dev(mmc)->dma_mask = &host->dma_mask;
25792579

2580+
host->timeout_clks = 3 * 1048576;
2581+
host->dma.gpd = dma_alloc_coherent(&pdev->dev,
2582+
2 * sizeof(struct mt_gpdma_desc),
2583+
&host->dma.gpd_addr, GFP_KERNEL);
2584+
host->dma.bd = dma_alloc_coherent(&pdev->dev,
2585+
MAX_BD_NUM * sizeof(struct mt_bdma_desc),
2586+
&host->dma.bd_addr, GFP_KERNEL);
2587+
if (!host->dma.gpd || !host->dma.bd) {
2588+
ret = -ENOMEM;
2589+
goto release_mem;
2590+
}
2591+
msdc_init_gpd_bd(host, &host->dma);
2592+
INIT_DELAYED_WORK(&host->req_timeout, msdc_request_timeout);
2593+
spin_lock_init(&host->lock);
2594+
2595+
platform_set_drvdata(pdev, mmc);
2596+
msdc_ungate_clock(host);
2597+
msdc_init_hw(host);
2598+
25802599
if (mmc->caps2 & MMC_CAP2_CQE) {
25812600
host->cq_host = devm_kzalloc(mmc->parent,
25822601
sizeof(*host->cq_host),
@@ -2597,25 +2616,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
25972616
mmc->max_seg_size = 64 * 1024;
25982617
}
25992618

2600-
host->timeout_clks = 3 * 1048576;
2601-
host->dma.gpd = dma_alloc_coherent(&pdev->dev,
2602-
2 * sizeof(struct mt_gpdma_desc),
2603-
&host->dma.gpd_addr, GFP_KERNEL);
2604-
host->dma.bd = dma_alloc_coherent(&pdev->dev,
2605-
MAX_BD_NUM * sizeof(struct mt_bdma_desc),
2606-
&host->dma.bd_addr, GFP_KERNEL);
2607-
if (!host->dma.gpd || !host->dma.bd) {
2608-
ret = -ENOMEM;
2609-
goto release_mem;
2610-
}
2611-
msdc_init_gpd_bd(host, &host->dma);
2612-
INIT_DELAYED_WORK(&host->req_timeout, msdc_request_timeout);
2613-
spin_lock_init(&host->lock);
2614-
2615-
platform_set_drvdata(pdev, mmc);
2616-
msdc_ungate_clock(host);
2617-
msdc_init_hw(host);
2618-
26192619
ret = devm_request_irq(&pdev->dev, host->irq, msdc_irq,
26202620
IRQF_TRIGGER_NONE, pdev->name, host);
26212621
if (ret)

0 commit comments

Comments
 (0)