On power up / reboot sometimes the mmc controller will have its irq line asserted. Getting this de-asserted requires enabling the clocks and then resetting the mmc controller. Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- drivers/mmc/host/sunxi-mci.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sunxi-mci.c b/drivers/mmc/host/sunxi-mci.c index 0eb59be..8b47c99 100644 --- a/drivers/mmc/host/sunxi-mci.c +++ b/drivers/mmc/host/sunxi-mci.c @@ -737,13 +737,6 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, if (IS_ERR(host->reg_base)) return PTR_ERR(host->reg_base); - host->irq = platform_get_irq(pdev, 0); - ret = devm_request_irq(&pdev->dev, host->irq, sunxi_mmc_irq, 0, - "sunxi-mci", host); - if (ret) - return ret; - disable_irq(host->irq); - host->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); if (IS_ERR(host->clk_ahb)) { dev_err(&pdev->dev, "Could not get ahb clock\n"); @@ -756,7 +749,21 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, return PTR_ERR(host->clk_mod); } - return 0; + /* Make sure the controller is in a sane state before enabling irqs */ + ret = sunxi_mmc_init_host(host->mmc); + if (ret) + return ret; + + host->irq = platform_get_irq(pdev, 0); + ret = devm_request_irq(&pdev->dev, host->irq, sunxi_mmc_irq, 0, + "sunxi-mci", host); + if (ret == 0) + disable_irq(host->irq); + + /* And put it back in reset */ + sunxi_mmc_exit_host(host); + + return ret; } static int sunxi_mmc_probe(struct platform_device *pdev) -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html