1 From 10df11bb736c8166e53b41f96688b2e6bd53773b Mon Sep 17 00:00:00 2001
2 From: Richard Zhu <r65037@freescale.com>
3 Date: Fri, 16 Dec 2011 10:08:04 +0800
4 Subject: [PATCH] ENGR00170244-1 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 a53c29d7e484a3562e3a4f24d952485fbeb4c933)
13 arch/arm/plat-mxc/ahci_sata.c | 30 ++++++++++++++++++++-------
14 arch/arm/plat-mxc/include/mach/ahci_sata.h | 1 +
15 2 files changed, 23 insertions(+), 8 deletions(-)
17 diff --git a/arch/arm/plat-mxc/ahci_sata.c b/arch/arm/plat-mxc/ahci_sata.c
18 index 466636b..76a2747 100644
19 --- a/arch/arm/plat-mxc/ahci_sata.c
20 +++ b/arch/arm/plat-mxc/ahci_sata.c
21 @@ -156,7 +156,7 @@ static int sata_init(struct device *dev)
26 + int ret = 0, iterations = 20;
29 sata_clk = clk_get(dev, "imx_sata_clk");
30 @@ -281,14 +281,28 @@ static int sata_init(struct device *dev)
32 if (AHCI_SAVE_PWR_WITHOUT_HOTPLUG) {
33 /* Release resources when there is no device on the port */
34 - if ((readl(mmio + PORT_SATA_SR) & 0xF) == 0) {
36 - if (machine_is_mx53_smd() || machine_is_mx53_loco()
37 - || board_is_mx53_ard_b())
40 + if ((readl(mmio + PORT_SATA_SR) & 0xF) == 0)
47 + if (iterations == 0) {
48 + pr_info("No sata disk.\n");
50 + /* Enter into PDDQ mode, save power */
51 + tmpdata = readl(mmio + PORT_PHY_CTL);
52 + writel(tmpdata | PORT_PHY_CTL_PDDQ_LOC,
53 + mmio + PORT_PHY_CTL);
55 + if (machine_is_mx53_smd()
56 + || machine_is_mx53_loco()
57 + || board_is_mx53_ard_b())
62 + } while (iterations-- > 0);
66 diff --git a/arch/arm/plat-mxc/include/mach/ahci_sata.h b/arch/arm/plat-mxc/include/mach/ahci_sata.h
67 index ea68a19..e31797b 100644
68 --- a/arch/arm/plat-mxc/include/mach/ahci_sata.h
69 +++ b/arch/arm/plat-mxc/include/mach/ahci_sata.h
70 @@ -37,6 +37,7 @@ enum {
71 PORT_PHY_CTL_CAP_DAT_LOC = 0x20000,
72 PORT_PHY_CTL_WRITE_LOC = 0x40000,
73 PORT_PHY_CTL_READ_LOC = 0x80000,
74 + PORT_PHY_CTL_PDDQ_LOC = 0x100000,
75 /* Port0 PHY Status */