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

144 lines
5.2 KiB
Diff

From 81fd9a79323dc1f02f633700502e381512687a2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 15 Feb 2021 09:11:16 +0100
Subject: [PATCH 162/388] 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 <megi@xff.cz>
---
drivers/mmc/host/sunxi-mmc.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 3db9f32d6..c5d048411 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -949,9 +949,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)
@@ -977,8 +983,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);
@@ -993,8 +999,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)
@@ -1464,10 +1470,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)
@@ -1492,11 +1498,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);
@@ -1533,7 +1539,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;
@@ -1541,8 +1546,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)
@@ -1552,8 +1555,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