Skip to content

Commit dfeae33

Browse files
committed
Merge tag 'mmc-v5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "A couple of MMC fixes intended for v5.0-rc7. MMC core: - Fix deadlock bug for block I/O requests MMC host: - sunxi: Disable broken HS-DDR mode for H5 by default - sunxi: Avoid unsupported speed modes declared via DT - meson-gx: Restore interrupt name" * tag 'mmc-v5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: meson-gx: fix interrupt name mmc: block: handle complete_work on separate workqueue mmc: sunxi: Filter out unsupported modes declared in the device tree mmc: sunxi: Disable HS-DDR mode for H5 eMMC controller by default
2 parents 545aabc + 83e418a commit dfeae33

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

drivers/mmc/core/block.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,7 @@ static void mmc_blk_mq_req_done(struct mmc_request *mrq)
21122112
if (waiting)
21132113
wake_up(&mq->wait);
21142114
else
2115-
kblockd_schedule_work(&mq->complete_work);
2115+
queue_work(mq->card->complete_wq, &mq->complete_work);
21162116

21172117
return;
21182118
}
@@ -2924,6 +2924,13 @@ static int mmc_blk_probe(struct mmc_card *card)
29242924

29252925
mmc_fixup_device(card, mmc_blk_fixups);
29262926

2927+
card->complete_wq = alloc_workqueue("mmc_complete",
2928+
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
2929+
if (unlikely(!card->complete_wq)) {
2930+
pr_err("Failed to create mmc completion workqueue");
2931+
return -ENOMEM;
2932+
}
2933+
29272934
md = mmc_blk_alloc(card);
29282935
if (IS_ERR(md))
29292936
return PTR_ERR(md);
@@ -2987,6 +2994,7 @@ static void mmc_blk_remove(struct mmc_card *card)
29872994
pm_runtime_put_noidle(&card->dev);
29882995
mmc_blk_remove_req(md);
29892996
dev_set_drvdata(&card->dev, NULL);
2997+
destroy_workqueue(card->complete_wq);
29902998
}
29912999

29923000
static int _mmc_blk_suspend(struct mmc_card *card)

drivers/mmc/host/meson-gx-mmc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
13381338
host->regs + SD_EMMC_IRQ_EN);
13391339

13401340
ret = request_threaded_irq(host->irq, meson_mmc_irq,
1341-
meson_mmc_irq_thread, IRQF_SHARED, NULL, host);
1341+
meson_mmc_irq_thread, IRQF_SHARED,
1342+
dev_name(&pdev->dev), host);
13421343
if (ret)
13431344
goto err_init_clk;
13441345

drivers/mmc/host/sunxi-mmc.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,13 +1399,37 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
13991399
mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
14001400
MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ;
14011401

1402-
if (host->cfg->clk_delays || host->use_new_timings)
1402+
/*
1403+
* Some H5 devices do not have signal traces precise enough to
1404+
* use HS DDR mode for their eMMC chips.
1405+
*
1406+
* We still enable HS DDR modes for all the other controller
1407+
* variants that support them.
1408+
*/
1409+
if ((host->cfg->clk_delays || host->use_new_timings) &&
1410+
!of_device_is_compatible(pdev->dev.of_node,
1411+
"allwinner,sun50i-h5-emmc"))
14031412
mmc->caps |= MMC_CAP_1_8V_DDR | MMC_CAP_3_3V_DDR;
14041413

14051414
ret = mmc_of_parse(mmc);
14061415
if (ret)
14071416
goto error_free_dma;
14081417

1418+
/*
1419+
* If we don't support delay chains in the SoC, we can't use any
1420+
* of the higher speed modes. Mask them out in case the device
1421+
* tree specifies the properties for them, which gets added to
1422+
* the caps by mmc_of_parse() above.
1423+
*/
1424+
if (!(host->cfg->clk_delays || host->use_new_timings)) {
1425+
mmc->caps &= ~(MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR |
1426+
MMC_CAP_1_2V_DDR | MMC_CAP_UHS);
1427+
mmc->caps2 &= ~MMC_CAP2_HS200;
1428+
}
1429+
1430+
/* TODO: This driver doesn't support HS400 mode yet */
1431+
mmc->caps2 &= ~MMC_CAP2_HS400;
1432+
14091433
ret = sunxi_mmc_init_host(host);
14101434
if (ret)
14111435
goto error_free_dma;

include/linux/mmc/card.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ struct mmc_card {
308308
unsigned int nr_parts;
309309

310310
unsigned int bouncesz; /* Bounce buffer size */
311+
struct workqueue_struct *complete_wq; /* Private workqueue */
311312
};
312313

313314
static inline bool mmc_large_sector(struct mmc_card *card)

0 commit comments

Comments
 (0)