build/patch/kernel/archive/sunxi-6.4/patches.megous/mmc-dw-mmc-rockchip-fix-sdmmc-after-soft-reboot.patch

53 lines
1.6 KiB
Diff

From 9831a9ede62e18a00de055a3f7bd5f161391d491 Mon Sep 17 00:00:00 2001
From: Peter Geis <pgwipeout@gmail.com>
Date: Sat, 22 Jan 2022 20:35:39 +0000
Subject: [PATCH 319/469] mmc: dw-mmc-rockchip: fix sdmmc after soft reboot
During shutdown the dw-mmc driver shuts down the vqmmc regulator.
This leads to situations where the sdmmc is unavailable after a soft
reboot.
Fix this by ensuring the vqmmc regulator is powered up on kernel
shutdown.
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
drivers/mmc/host/dw_mmc-rockchip.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index 2a99f15f527f..60c48885f672 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -10,6 +10,7 @@
#include <linux/of_address.h>
#include <linux/mmc/slot-gpio.h>
#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include "dw_mmc.h"
@@ -390,9 +391,20 @@ static const struct dev_pm_ops dw_mci_rockchip_dev_pm_ops = {
NULL)
};
+static void dw_mci_rockchip_shutdown(struct platform_device *pdev)
+{
+ struct dw_mci *host = dev_get_drvdata(&pdev->dev);
+ struct mmc_host *mmc = host->slot->mmc;
+
+ if (!IS_ERR(mmc->supply.vqmmc) && !(host->vqmmc_enabled))
+ if(!regulator_enable(mmc->supply.vqmmc))
+ host->vqmmc_enabled = true;
+}
+
static struct platform_driver dw_mci_rockchip_pltfm_driver = {
.probe = dw_mci_rockchip_probe,
.remove = dw_mci_rockchip_remove,
+ .shutdown = dw_mci_rockchip_shutdown,
.driver = {
.name = "dwmmc_rockchip",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.34.1