]> code.ossystems Code Review - meta-freescale.git/blob
3b14b8de6e6b72e40d95ce4e5623107968d28fbb
[meta-freescale.git] /
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
5
6 In order to save the power consumption, enable the
7 PDDQ mode of AHCI PHY when there is no sata disk
8 on the port
9
10 Signed-off-by: Richard Zhu <r65037@freescale.com>
11 (cherry picked from commit f97994abf50e9917a959ae62eabd08908a75a222)
12 ---
13  drivers/hwmon/imx_ahci_hwmon.c |   10 ++++++++++
14  1 files changed, 10 insertions(+), 0 deletions(-)
15
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,
21                 return -1;
22         }
23  
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);
28 +
29         /* check rd-wr to reg */
30         read_sum = 0;
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);
35  
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);
39 +
40         iounmap(mmio);
41  
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);
46         clk_put(sata_clk);
47 +
48         mutex_unlock(&hwmon->lock);
49  
50         return sprintf(buf, "%d\n", temp * 1000);
51 -- 
52 1.5.4.4
53