PKGBUILDs/core/kernel26-olinuxino/1147-ENGR00170244-2-ARM-AHCI-Enable-PDDQ-mode-when-no-d.patch
2012-07-14 22:54:21 +03:00

54 lines
1.7 KiB
Diff

From 3cb5c41657a793fd442766d076eddde06af9c9ce Mon Sep 17 00:00:00 2001
From: Richard Zhu <r65037@freescale.com>
Date: Fri, 16 Dec 2011 10:08:42 +0800
Subject: [PATCH] ENGR00170244-2 ARM: AHCI: Enable PDDQ mode when no disk is attached
In order to save the power consumption, enable the
PDDQ mode of AHCI PHY when there is no sata disk
on the port
Signed-off-by: Richard Zhu <r65037@freescale.com>
(cherry picked from commit f97994abf50e9917a959ae62eabd08908a75a222)
---
drivers/hwmon/imx_ahci_hwmon.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/hwmon/imx_ahci_hwmon.c b/drivers/hwmon/imx_ahci_hwmon.c
index 62048f7..7688d92 100644
--- a/drivers/hwmon/imx_ahci_hwmon.c
+++ b/drivers/hwmon/imx_ahci_hwmon.c
@@ -90,6 +90,11 @@ static ssize_t imx_ahci_hwmon_temp_show(struct device *dev,
return -1;
}
+ /* Disable PDDQ mode when this mode is enabled */
+ read_sum = readl(mmio + PORT_PHY_CTL);
+ if (read_sum & PORT_PHY_CTL_PDDQ_LOC)
+ writel(read_sum & ~PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
+
/* check rd-wr to reg */
read_sum = 0;
sata_phy_cr_addr(SATA_PHY_CR_CLOCK_CRCMP_LT_LIMIT, mmio);
@@ -230,6 +235,10 @@ static ssize_t imx_ahci_hwmon_temp_show(struct device *dev,
a = (m2 - m1) / (m2 / 1000);
temp = ((((-559) * a) / 1000) * a) / 1000 + (1379) * a / 1000 + (-458);
+ /* Enable PDDQ mode to save power */
+ read_sum = readl(mmio + PORT_PHY_CTL);
+ writel(read_sum | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
+
iounmap(mmio);
/* Release the clocks */
@@ -237,6 +246,7 @@ static ssize_t imx_ahci_hwmon_temp_show(struct device *dev,
clk_put(sata_ref_clk);
clk_disable(sata_clk);
clk_put(sata_clk);
+
mutex_unlock(&hwmon->lock);
return sprintf(buf, "%d\n", temp * 1000);
--
1.5.4.4