build/patch/kernel/meson64-dev/0009-HACK-mmc-core-always-re-init-sdcards-to-set-default-.patch
2020-09-01 12:59:15 +02:00

58 lines
1.5 KiB
Diff

From ff40d6a1ec6c9d661232d99ecb8e3a3409add62d Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Thu, 16 Apr 2020 08:31:55 +0000
Subject: [PATCH 09/40] HACK: mmc: core: always re-init sdcards to set default
3.3v regulator ios
sd-uhs-** in device-tree changes the voltage to 1.8v, so we need to ensure
the card is reset to 3.3v before rebooting else on reboot there is no card
to boot from.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/mmc/core/sd.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 5a2210c25aa7..6499ab41195b 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1215,6 +1215,26 @@ static int mmc_sd_suspend(struct mmc_host *host)
return err;
}
+/*
+ * Callback for shutdown
+ */
+static int mmc_sd_shutdown(struct mmc_host *host)
+{
+ mmc_claim_host(host);
+
+ if (mmc_card_suspended(host->card))
+ goto out;
+
+ mmc_power_off(host);
+ mmc_card_set_suspended(host->card);
+
+ pm_runtime_disable(&host->card->dev);
+ pm_runtime_set_suspended(&host->card->dev);
+
+out:
+ return 0;
+}
+
/*
* This function tries to determine if the same card is still present
* and, if so, restore all state to it.
@@ -1293,7 +1313,7 @@ static const struct mmc_bus_ops mmc_sd_ops = {
.suspend = mmc_sd_suspend,
.resume = mmc_sd_resume,
.alive = mmc_sd_alive,
- .shutdown = mmc_sd_suspend,
+ .shutdown = mmc_sd_shutdown,
.hw_reset = mmc_sd_hw_reset,
};
--
2.25.1