mirror of
https://github.com/armbian/build.git
synced 2025-08-14 15:16:58 +02:00
* Recycling of megous v5.16.4 patches The patches were sorted as far as possible. Some patches are renamed according to their place of application. The length of the patch name has been changed to improve readability using the `git format-patch --filename-max-length=75` method. The folder containing the patches will have the name `patches.name` and the corresponding file `series.name` for the convenience of processing and moving them upstream. But the control file remains `series.conf`. Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * Add a series of armbian patches for 5.16 Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * Remove patches whose fixes are already in the kernel Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>
157 lines
4.3 KiB
Diff
157 lines
4.3 KiB
Diff
From 81cfa3162e946871b19ea01b48b6f4057be2382d Mon Sep 17 00:00:00 2001
|
|
From: Manish Narani <manish.narani@xilinx.com>
|
|
Date: Tue, 18 Sep 2018 20:34:06 +0530
|
|
Subject: [PATCH 260/446] sdhci: arasan: Add runtime PM support
|
|
|
|
Add runtime PM support in Arasan SDHCI driver.
|
|
|
|
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
|
|
---
|
|
drivers/mmc/host/sdhci-of-arasan.c | 88 +++++++++++++++++++++++++++++-
|
|
1 file changed, 86 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
|
|
index 6a2e5a468..e08d6efd9 100644
|
|
--- a/drivers/mmc/host/sdhci-of-arasan.c
|
|
+++ b/drivers/mmc/host/sdhci-of-arasan.c
|
|
@@ -19,6 +19,7 @@
|
|
#include <linux/mfd/syscon.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of_device.h>
|
|
+#include <linux/pm_runtime.h>
|
|
#include <linux/phy/phy.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/of.h>
|
|
@@ -27,6 +28,7 @@
|
|
#include "cqhci.h"
|
|
#include "sdhci-pltfm.h"
|
|
|
|
+#define SDHCI_ARASAN_AUTOSUSPEND_DELAY 2000 /* ms */
|
|
#define SDHCI_ARASAN_VENDOR_REGISTER 0x78
|
|
|
|
#define SDHCI_ARASAN_ITAPDLY_REGISTER 0xF0F8
|
|
@@ -472,6 +474,70 @@ static const struct sdhci_pltfm_data sdhci_arasan_thunderbay_pdata = {
|
|
SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400,
|
|
};
|
|
|
|
+#ifdef CONFIG_PM
|
|
+static int sdhci_arasan_runtime_suspend(struct device *dev)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct sdhci_host *host = platform_get_drvdata(pdev);
|
|
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
|
+ struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
|
|
+ int ret;
|
|
+
|
|
+ if (sdhci_arasan->has_cqe) {
|
|
+ ret = cqhci_suspend(host->mmc);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ ret = sdhci_runtime_suspend_host(host);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
|
+ mmc_retune_needed(host->mmc);
|
|
+
|
|
+ clk_disable(pltfm_host->clk);
|
|
+ clk_disable(sdhci_arasan->clk_ahb);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int sdhci_arasan_runtime_resume(struct device *dev)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct sdhci_host *host = platform_get_drvdata(pdev);
|
|
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
|
+ struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
|
|
+ int ret;
|
|
+
|
|
+ ret = clk_enable(sdhci_arasan->clk_ahb);
|
|
+ if (ret) {
|
|
+ dev_err(dev, "Cannot enable AHB clock.\n");
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ ret = clk_enable(pltfm_host->clk);
|
|
+ if (ret) {
|
|
+ dev_err(dev, "Cannot enable SD clock.\n");
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ ret = sdhci_runtime_resume_host(host, 0);
|
|
+ if (ret)
|
|
+ goto out;
|
|
+
|
|
+ if (sdhci_arasan->has_cqe)
|
|
+ return cqhci_resume(host->mmc);
|
|
+
|
|
+ return 0;
|
|
+out:
|
|
+ clk_disable(pltfm_host->clk);
|
|
+ clk_disable(sdhci_arasan->clk_ahb);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+#endif /* ! CONFIG_PM */
|
|
+
|
|
#ifdef CONFIG_PM_SLEEP
|
|
/**
|
|
* sdhci_arasan_suspend - Suspend method for the driver
|
|
@@ -568,8 +634,10 @@ static int sdhci_arasan_resume(struct device *dev)
|
|
}
|
|
#endif /* ! CONFIG_PM_SLEEP */
|
|
|
|
-static SIMPLE_DEV_PM_OPS(sdhci_arasan_dev_pm_ops, sdhci_arasan_suspend,
|
|
- sdhci_arasan_resume);
|
|
+static const struct dev_pm_ops sdhci_arasan_dev_pm_ops = {
|
|
+ SET_SYSTEM_SLEEP_PM_OPS(sdhci_arasan_suspend, sdhci_arasan_resume)
|
|
+ SET_RUNTIME_PM_OPS(sdhci_arasan_runtime_suspend,
|
|
+ sdhci_arasan_runtime_resume, NULL) };
|
|
|
|
/**
|
|
* sdhci_arasan_sdcardclk_recalc_rate - Return the card clock rate
|
|
@@ -1708,13 +1776,25 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
|
|
host->mmc->caps2 |= MMC_CAP2_CQE_DCMD;
|
|
}
|
|
|
|
+ pm_runtime_get_noresume(&pdev->dev);
|
|
+ pm_runtime_set_active(&pdev->dev);
|
|
+ pm_runtime_enable(&pdev->dev);
|
|
+ pm_runtime_set_autosuspend_delay(&pdev->dev,
|
|
+ SDHCI_ARASAN_AUTOSUSPEND_DELAY);
|
|
+ pm_runtime_use_autosuspend(&pdev->dev);
|
|
+
|
|
ret = sdhci_arasan_add_host(sdhci_arasan);
|
|
if (ret)
|
|
goto err_add_host;
|
|
|
|
+ pm_runtime_put_autosuspend(&pdev->dev);
|
|
+
|
|
return 0;
|
|
|
|
err_add_host:
|
|
+ pm_runtime_disable(&pdev->dev);
|
|
+ pm_runtime_set_suspended(&pdev->dev);
|
|
+ pm_runtime_put_noidle(&pdev->dev);
|
|
if (!IS_ERR(sdhci_arasan->phy))
|
|
phy_exit(sdhci_arasan->phy);
|
|
unreg_clk:
|
|
@@ -1742,6 +1822,10 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
|
|
phy_exit(sdhci_arasan->phy);
|
|
}
|
|
|
|
+ pm_runtime_get_sync(&pdev->dev);
|
|
+ pm_runtime_disable(&pdev->dev);
|
|
+ pm_runtime_put_noidle(&pdev->dev);
|
|
+
|
|
sdhci_arasan_unregister_sdclk(&pdev->dev);
|
|
|
|
ret = sdhci_pltfm_unregister(pdev);
|
|
--
|
|
2.31.1
|
|
|