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