From 53639b3558c206be0fec6153f307e5c28f1dd343 Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Thu, 28 May 2020 14:16:52 +0200 Subject: [PATCH 06/22] mmc: core: pwrseq_simple: disable mmc power on shutdown Fix for Broadcom SDIO WiFi modules. They misbehave if reinitialized without a power cycle. Signed-off-by: Tobias Schramm --- drivers/mmc/core/pwrseq_simple.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index ea4d3670560e..38fe7e29aba6 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -80,10 +80,8 @@ static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) msleep(pwrseq->post_power_on_delay_ms); } -static void mmc_pwrseq_simple_power_off(struct mmc_host *host) +static void __mmc_pwrseq_simple_power_off(struct mmc_pwrseq_simple *pwrseq) { - struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); - mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); if (pwrseq->power_off_delay_us) @@ -96,6 +94,12 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) } } +static void mmc_pwrseq_simple_power_off(struct mmc_host *host) +{ + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + __mmc_pwrseq_simple_power_off(pwrseq); +} + static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { .pre_power_on = mmc_pwrseq_simple_pre_power_on, .post_power_on = mmc_pwrseq_simple_post_power_on, @@ -151,9 +155,18 @@ static int mmc_pwrseq_simple_remove(struct platform_device *pdev) return 0; } +static void mmc_pwrseq_simple_shutdown(struct platform_device *pdev) +{ + struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev); + + dev_info(&pdev->dev, "Turning off mmc\n"); + __mmc_pwrseq_simple_power_off(pwrseq); +} + static struct platform_driver mmc_pwrseq_simple_driver = { .probe = mmc_pwrseq_simple_probe, .remove = mmc_pwrseq_simple_remove, + .shutdown = mmc_pwrseq_simple_shutdown, .driver = { .name = "pwrseq_simple", .of_match_table = mmc_pwrseq_simple_of_match, -- 2.30.0