kernel/0115-feat-sd-wifi-support-power-management.patch
2024-12-19 16:34:44 -05:00

80 lines
2.6 KiB
Diff

From d1a64f6e731029d7baf30ec891aa69ceb5dc17b4 Mon Sep 17 00:00:00 2001
From: liangshuang <liangshuang@eswincomputing.com>
Date: Thu, 18 Jul 2024 11:27:17 +0800
Subject: [PATCH 115/219] feat:sd/wifi support power management.
Changelogs:
1.sd/wifi support power management.
Signed-off-by: liangshuang <liangshuang@eswincomputing.com>
---
arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts | 1 +
arch/riscv/boot/dts/eswin/hifive-premier-550.dts | 1 +
drivers/mmc/host/sdhci-of-eswin-sdio.c | 12 +++++++++++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts b/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts
index 385c39c4395b..dada3492fe11 100644
--- a/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts
+++ b/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts
@@ -497,6 +497,7 @@ &sdio1 {
drive-impedance-ohm = <33>;
enable-cmd-pullup;
enable-data-pullup;
+ keep-power-in-suspend;
non-removable;
no-sd;
no-mmc;
diff --git a/arch/riscv/boot/dts/eswin/hifive-premier-550.dts b/arch/riscv/boot/dts/eswin/hifive-premier-550.dts
index 163938a2a393..31a1b673b89c 100644
--- a/arch/riscv/boot/dts/eswin/hifive-premier-550.dts
+++ b/arch/riscv/boot/dts/eswin/hifive-premier-550.dts
@@ -431,6 +431,7 @@ &sdio1 {
enable-cmd-pullup;
enable-data-pullup;
non-removable;
+ keep-power-in-suspend;
no-sd;
no-mmc;
};
diff --git a/drivers/mmc/host/sdhci-of-eswin-sdio.c b/drivers/mmc/host/sdhci-of-eswin-sdio.c
index f9090ece0f65..a828298e0e02 100644
--- a/drivers/mmc/host/sdhci-of-eswin-sdio.c
+++ b/drivers/mmc/host/sdhci-of-eswin-sdio.c
@@ -227,7 +227,7 @@ static int eswin_sdhci_sdio_phase_code_tuning(struct sdhci_host *host,
return -EIO;
}
- pr_info("%s: set phase_code:0x%x\n", mmc_hostname(host->mmc), phase_code);
+ pr_debug("%s: set phase_code:0x%x\n", mmc_hostname(host->mmc), phase_code);
eswin_sdhci_disable_card_clk(host);
sdhci_writew(host, phase_code, VENDOR_AT_SATA_R);
@@ -959,6 +959,12 @@ static int eswin_sdhci_sdio_probe(struct platform_device *pdev)
if (ret)
goto unreg_clk;
+ pm_runtime_set_active(&pdev->dev);
+ pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
+ pm_runtime_use_autosuspend(&pdev->dev);
+ pm_suspend_ignore_children(&pdev->dev, 1);
+ pm_runtime_enable(&pdev->dev);
+
return 0;
unreg_clk:
@@ -985,6 +991,10 @@ static int eswin_sdhci_sdio_remove(struct platform_device *pdev)
struct clk *clk_ahb = eswin_sdhci_sdio->clk_ahb;
void __iomem *core_clk_reg = eswin_sdhci_sdio->core_clk_reg;
+ pm_runtime_get_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ pm_runtime_put_noidle(&pdev->dev);
+
sdhci_pltfm_remove(pdev);
win2030_tbu_power(&pdev->dev, false);
--
2.47.0