build/patch/kernel/archive/sunxi-5.15/patches.megous/mmc-sunxi-mmc-Remove-runtime-PM.patch

144 lines
5.2 KiB
Diff
Raw Permalink Normal View History

From d017ce354b843691beea7028d4a265816b6548e5 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Mon, 15 Feb 2021 09:11:16 +0100
Subject: [PATCH 274/478] mmc: sunxi-mmc: Remove runtime-PM
With runtime PM I get a lot of errors like (on H5/H6 f2fs formatted
rootfs):
[81360.499781] mmc_erase: group start error -110, status 0x0
[81360.550703] mmc_erase: group start error -110, status 0x0
[81360.599594] sunxi-mmc 4020000.mmc: data error, sending stop command
[81360.599611] sunxi-mmc 4020000.mmc: send stop command failed
[83474.053131] mmc_erase: group start error -110, status 0x0
[83474.104043] mmc_erase: group start error -110, status 0x0
[83850.888258] mmc_erase: group start error -110, status 0x0
[83850.938810] mmc_erase: group start error -110, status 0x0
[83850.989808] mmc_erase: group start error -110, status 0x0
[83851.040888] mmc_erase: group start error -110, status 0x0
[83851.091908] mmc_erase: group start error -110, status 0x0
[83851.142938] mmc_erase: group start error -110, status 0x0
[83851.193806] sunxi-mmc 4020000.mmc: data error, sending stop command
[83851.193825] sunxi-mmc 4020000.mmc: send stop command failed
[83851.201040] sunxi-mmc 4020000.mmc: data error, sending stop command
[83851.201062] sunxi-mmc 4020000.mmc: send stop command failed
[83851.720183] mmc_erase: group start error -110, status 0x0
[83851.770866] mmc_erase: group start error -110, status 0x0
[83851.821418] mmc_erase: group start error -110, status 0x0
[83851.872081] mmc_erase: group start error -110, status 0x0
[83851.922757] mmc_erase: group start error -110, status 0x0
[83851.999497] mmc_erase: group start error -110, status 0x0
[83852.050151] mmc_erase: group start error -110, status 0x0
[83852.101319] mmc_erase: group start error -110, status 0x0
[83852.152189] mmc_erase: group start error -110, status 0x0
[83852.202866] mmc_erase: group start error -110, status 0x0
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/mmc/host/sunxi-mmc.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 2702736a1c57..55ca34803a3f 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -948,9 +948,15 @@ static void sunxi_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct sunxi_mmc_host *host = mmc_priv(mmc);
+ if (ios->power_mode == MMC_POWER_OFF)
+ sunxi_mmc_reset_host(host);
+
sunxi_mmc_card_power(host, ios);
sunxi_mmc_set_bus_width(host, ios->bus_width);
sunxi_mmc_set_clk(host, ios);
+
+ if (ios->power_mode == MMC_POWER_UP)
+ sunxi_mmc_init_host(host);
}
static int sunxi_mmc_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
@@ -976,8 +982,8 @@ static void sunxi_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
unsigned long flags;
u32 imask;
- if (enable)
- pm_runtime_get_noresume(host->dev);
+ //if (enable)
+ //pm_runtime_get_noresume(host->dev);
spin_lock_irqsave(&host->lock, flags);
@@ -992,8 +998,8 @@ static void sunxi_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
mmc_writel(host, REG_IMASK, imask);
spin_unlock_irqrestore(&host->lock, flags);
- if (!enable)
- pm_runtime_put_noidle(host->mmc->parent);
+ //if (!enable)
+ //pm_runtime_put_noidle(host->mmc->parent);
}
static void sunxi_mmc_hw_reset(struct mmc_host *mmc)
@@ -1454,10 +1460,10 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
if (ret)
goto error_free_dma;
- pm_runtime_set_active(&pdev->dev);
- pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
- pm_runtime_use_autosuspend(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
+ //pm_runtime_set_active(&pdev->dev);
+ //pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
+ //pm_runtime_use_autosuspend(&pdev->dev);
+ //pm_runtime_enable(&pdev->dev);
ret = mmc_add_host(mmc);
if (ret)
@@ -1483,11 +1489,11 @@ static int sunxi_mmc_remove(struct platform_device *pdev)
struct sunxi_mmc_host *host = mmc_priv(mmc);
mmc_remove_host(mmc);
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev)) {
+ //pm_runtime_disable(&pdev->dev);
+ //if (!pm_runtime_status_suspended(&pdev->dev)) {
disable_irq(host->irq);
sunxi_mmc_disable(host);
- }
+ //}
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
mmc_free_host(mmc);
@@ -1521,7 +1527,6 @@ static int sunxi_mmc_runtime_suspend(struct device *dev)
* Disabling the irq will prevent this.
*/
disable_irq(host->irq);
- sunxi_mmc_reset_host(host);
sunxi_mmc_disable(host);
return 0;
@@ -1529,8 +1534,6 @@ static int sunxi_mmc_runtime_suspend(struct device *dev)
#endif
static const struct dev_pm_ops sunxi_mmc_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(sunxi_mmc_runtime_suspend,
sunxi_mmc_runtime_resume,
NULL)
@@ -1540,8 +1543,8 @@ static struct platform_driver sunxi_mmc_driver = {
.driver = {
.name = "sunxi-mmc",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
- .of_match_table = sunxi_mmc_of_match,
- .pm = &sunxi_mmc_pm_ops,
+ .of_match_table = of_match_ptr(sunxi_mmc_of_match),
+ //.pm = &sunxi_mmc_pm_ops,
},
.probe = sunxi_mmc_probe,
.remove = sunxi_mmc_remove,
--
2.35.3