summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhu <r65037@freescale.com>2011-12-16 10:08:04 +0800
committerAndy Voltz <andy.voltz@timesys.com>2012-03-09 11:26:47 -0500
commit6982937a3515615435c0c654c80352d890b0ff34 (patch)
treefb4e0a0b93462eabdbac89936829ba9fb0fe05f0
parentb1cc800794a27e5f964c4bd7b7d9ef8bc7ab4b04 (diff)
ENGR00170244-1 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 a53c29d7e484a3562e3a4f24d952485fbeb4c933)
-rw-r--r--arch/arm/plat-mxc/ahci_sata.c30
-rw-r--r--arch/arm/plat-mxc/include/mach/ahci_sata.h1
2 files changed, 23 insertions, 8 deletions
diff --git a/arch/arm/plat-mxc/ahci_sata.c b/arch/arm/plat-mxc/ahci_sata.c
index 466636ba3abd..76a27470f321 100644
--- a/arch/arm/plat-mxc/ahci_sata.c
+++ b/arch/arm/plat-mxc/ahci_sata.c
@@ -156,7 +156,7 @@ static int sata_init(struct device *dev)
{
void __iomem *mmio;
u32 tmpdata;
- int ret = 0;
+ int ret = 0, iterations = 20;
struct clk *clk;
sata_clk = clk_get(dev, "imx_sata_clk");
@@ -281,14 +281,28 @@ static int sata_init(struct device *dev)
if (AHCI_SAVE_PWR_WITHOUT_HOTPLUG) {
/* Release resources when there is no device on the port */
- if ((readl(mmio + PORT_SATA_SR) & 0xF) == 0) {
- ret = -ENODEV;
- if (machine_is_mx53_smd() || machine_is_mx53_loco()
- || board_is_mx53_ard_b())
- goto no_device;
+ do {
+ if ((readl(mmio + PORT_SATA_SR) & 0xF) == 0)
+ msleep(25);
else
- goto release_mem;
- }
+ break;
+
+ if (iterations == 0) {
+ pr_info("No sata disk.\n");
+ ret = -ENODEV;
+ /* Enter into PDDQ mode, save power */
+ tmpdata = readl(mmio + PORT_PHY_CTL);
+ writel(tmpdata | PORT_PHY_CTL_PDDQ_LOC,
+ mmio + PORT_PHY_CTL);
+
+ if (machine_is_mx53_smd()
+ || machine_is_mx53_loco()
+ || board_is_mx53_ard_b())
+ goto no_device;
+ else
+ goto release_mem;
+ }
+ } while (iterations-- > 0);
}
iounmap(mmio);
diff --git a/arch/arm/plat-mxc/include/mach/ahci_sata.h b/arch/arm/plat-mxc/include/mach/ahci_sata.h
index ea68a1917e5c..e31797be706b 100644
--- a/arch/arm/plat-mxc/include/mach/ahci_sata.h
+++ b/arch/arm/plat-mxc/include/mach/ahci_sata.h
@@ -37,6 +37,7 @@ enum {
PORT_PHY_CTL_CAP_DAT_LOC = 0x20000,
PORT_PHY_CTL_WRITE_LOC = 0x40000,
PORT_PHY_CTL_READ_LOC = 0x80000,
+ PORT_PHY_CTL_PDDQ_LOC = 0x100000,
/* Port0 PHY Status */
PORT_PHY_SR = 0x17c,
/* PORT_PHY_SR */