summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhu <r65037@freescale.com>2011-12-16 10:08:42 +0800
committerAndy Voltz <andy.voltz@timesys.com>2012-03-09 11:26:47 -0500
commit45bb119a58a85b397f9c762b9037609cc94caef4 (patch)
tree0974e7f6a1955410f7111064ca18969709239637
parent6982937a3515615435c0c654c80352d890b0ff34 (diff)
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)
-rw-r--r--drivers/hwmon/imx_ahci_hwmon.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hwmon/imx_ahci_hwmon.c b/drivers/hwmon/imx_ahci_hwmon.c
index 62048f764e0d..7688d92a2c92 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);