[PATCH 4/23] dove: fix the PCIe power management support

Brad Figg brad.figg at canonical.com
Thu Aug 27 23:20:44 UTC 2009


From: Saeed Bishara <saeed at marvell.com>

make sure only ports that were connected will be initialized when
resuming the system.

Signed-off-by: Saeed Bishara <saeed at marvell.com>
Signed-off-by: Brad Figg <brad.figg at canonical.com>
---
 arch/arm/mach-dove/pcie.c |   25 ++++++++++++++-----------
 arch/arm/mach-dove/pm.c   |    2 +-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index bd7b0cf..e14f7cb 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -11,10 +11,10 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/mbus.h>
+#include <linux/delay.h>
 #include <asm/mach/pci.h>
 #include <asm/mach/arch.h>
 #include <asm/setup.h>
-#include <asm/delay.h>
 #include <plat/pcie.h>
 #include <mach/irqs.h>
 #include <mach/bridge-regs.h>
@@ -253,7 +253,7 @@ void dove_restore_pcie_regs(void)
 	u32 reg;
 
 	/* Configure PCIE ports */
-	for (i=0; i<num_pcie_ports; i++)
+	for (i = 0; i<num_pcie_ports; i++)
 	{
 		orion_pcie_set_local_bus_nr(pcie_port[i].base, pcie_port[i].root_bus_nr);
 		orion_pcie_setup(pcie_port[i].base, &dove_mbus_dram_info);
@@ -265,18 +265,21 @@ void dove_restore_pcie_regs(void)
 	writel(reg, CPU_CONTROL);
 
 	/*
-	 * Loop waiting for link up on the phy of both ports.
-	 * In one or both ports does not have a card plugged in then this
-	 * loop will add a short delay
+	 * Loop waiting for link up on the phy of the ports.
 	 */
-	
+
 	do {
-		if (orion_pcie_link_up(pcie_port[0].base) && 
-		    orion_pcie_link_up(pcie_port[1].base))
+		int i;
+		int links_ready = 1;
+
+		for (i = 0; i < num_pcie_ports; i++)
+			if (!orion_pcie_link_up(pcie_port[i].base))
+				links_ready = 0;
+
+		if (links_ready)
 			break;
 
-		timeout--;
-		udelay(1000);
-	} while (timeout);
+		mdelay(1);
+	} while (timeout--);
 }
 #endif
diff --git a/arch/arm/mach-dove/pm.c b/arch/arm/mach-dove/pm.c
index 26485eb..107a1ac 100755
--- a/arch/arm/mach-dove/pm.c
+++ b/arch/arm/mach-dove/pm.c
@@ -690,7 +690,7 @@ void dove_standby(void)
 	/* Save generic list of registes */
 	pm_registers_action(RESTORE);
 
-	//dove_restore_pcie_regs(); /* Should be done after restoring cpu configuration registers */
+	dove_restore_pcie_regs(); /* Should be done after restoring cpu configuration registers */
 
 	/* Put off the Led on MPP7 */
 	reg = MV_REG_READ(PMU_SIG_SLCT_CTRL_0_REG);
-- 
1.6.0.4





More information about the kernel-team mailing list