Skip to contentSkip to conversation

ARM: tegra: PCI-e improvements

PATCH New Mike Rapoport 2 participants 5 messages Mar 2, 2011 – Mar 3, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: tegra: PCI-e improvements

Hi all,
This patches add PCI-e powergating support and fix for TrimSlice PCI-e initialization in the mutliplatform kernels.

The patches are also available at git repository
git://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux-tegra.git trimslice/upstream

The following changes since commit ccac05152e7c6a8103b9e7a801bc995180a800fc:

ARM: Tegra: DMA: Fail safe if initialization fails (2011-02-23 14:06:03 -0800)

Mike Rapoport (3):
ARM: tegra: PCIE minor code refactoring
ARM: tegra: add PCI Express power gating
ARM: tegra: trimslice: initialize PCI-e only when running on
TrimSlice

 arch/arm/mach-tegra/board-trimslice.c |    3 ++
 arch/arm/mach-tegra/pcie.c            |   38 ++++++++++++++++++++++++--------
 2 files changed, 31 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/3 ARM: tegra: PCIE minor code refactoring

Move tegra_pcie_power_off before tegra_pcie_power_on for clean addition of PCIE power gating

---
 arch/arm/mach-tegra/pcie.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-tegra/pcie.c +9 -9
index 53f5fa3..6de5ef4 100644
@@ -682,6 +682,15 @@ static void tegra_pcie_xclk_clamp(bool clamp)
 	pmc_writel(reg, PMC_SCRATCH42);
 }
 
+static void tegra_pcie_power_off(void)
+{
+	tegra_periph_reset_assert(tegra_pcie.pcie_xclk);
+	tegra_periph_reset_assert(tegra_pcie.afi_clk);
+	tegra_periph_reset_assert(tegra_pcie.pex_clk);
+
+	tegra_pcie_xclk_clamp(true);
+}
+
 static int tegra_pcie_power_on(void)
 {
 	tegra_pcie_xclk_clamp(true);
@@ -693,15 +702,6 @@ static int tegra_pcie_power_on(void)
 	return clk_enable(tegra_pcie.pll_e);
 }
 
-static void tegra_pcie_power_off(void)
-{
-	tegra_periph_reset_assert(tegra_pcie.pcie_xclk);
-	tegra_periph_reset_assert(tegra_pcie.afi_clk);
-	tegra_periph_reset_assert(tegra_pcie.pex_clk);
-
-	tegra_pcie_xclk_clamp(true);
-}
-
 static int tegra_pcie_clocks_get(void)
 {
 	int err;
Signature · 1 line
1.7.3.1
#2 lore raw

PATCH 2/3 ARM: tegra: add PCI Express power gating

In reply to Mike Rapoport
---
 arch/arm/mach-tegra/pcie.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/pcie.c +20 -2
index 6de5ef4..2941212 100644
@@ -39,6 +39,7 @@
 #include <mach/pinmux.h>
 #include <mach/iomap.h>
 #include <mach/clk.h>
+#include <mach/powergate.h>
 
 /* register definitions */
 #define AFI_OFFSET	0x3800
@@ -688,13 +689,30 @@ static void tegra_pcie_power_off(void)
 	tegra_periph_reset_assert(tegra_pcie.afi_clk);
 	tegra_periph_reset_assert(tegra_pcie.pex_clk);
 
+	tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
 	tegra_pcie_xclk_clamp(true);
 }
 
-static int tegra_pcie_power_on(void)
+static int tegra_pcie_power_regate(void)
 {
+	int err;
+
+	tegra_pcie_power_off();
+
 	tegra_pcie_xclk_clamp(true);
+
 	tegra_periph_reset_assert(tegra_pcie.pcie_xclk);
+	tegra_periph_reset_assert(tegra_pcie.afi_clk);
+
+	err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE,
+						tegra_pcie.pex_clk);
+	if (err) {
+		pr_err("PCIE: powerup sequence failed: %d\n", err);
+		return err;
+	}
+
+	tegra_periph_reset_deassert(tegra_pcie.afi_clk);
+
 	tegra_pcie_xclk_clamp(false);
 
 	clk_enable(tegra_pcie.afi_clk);
@@ -759,7 +777,7 @@ static int __init tegra_pcie_get_resources(void)
 		return err;
 	}
 
-	err = tegra_pcie_power_on();
+	err = tegra_pcie_power_regate();
 	if (err) {
 		pr_err("PCIE: failed to power up: %d\n", err);
 		goto err_pwr_on;
Signature · 1 line
1.7.3.1
#3 lore raw

PATCH 3/3 ARM: tegra: trimslice: initialize PCI-e only when running on TrimSlice

In reply to Mike Rapoport

Currently tegra_pcie_init is effectively called as subsys_initcall. With multiplatform kernel this may cause hangs on boards that don't intend to support Tegra2 PCI-e. Ensure that TrimSlice board code initializes PCI-e only when actually running on the TrimSlice.

---
 arch/arm/mach-tegra/board-trimslice.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/board-trimslice.c +3 -0
index 0f3081a..7be7d4a 100644
@@ -79,6 +79,9 @@ static __initdata struct tegra_clk_init_table trimslice_clk_init_table[] = {
 
 static int __init tegra_trimslice_pci_init(void)
 {
+	if (!machine_is_trimslice())
+		return 0;
+
 	return tegra_pcie_init(true, true);
 }
 subsys_initcall(tegra_trimslice_pci_init);
Signature · 1 line
1.7.3.1
#4 lore raw

cover ARM: tegra: PCI-e improvements

In reply to Mike Rapoport
Quoted 16 lines · Mike Rapoport

Hi all,
This patches add PCI-e powergating support and fix for TrimSlice PCI-e initialization in the mutliplatform kernels.

The patches are also available at git repository ?git://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux-tegra.git trimslice/upstream

The following changes since commit ccac05152e7c6a8103b9e7a801bc995180a800fc:

?ARM: Tegra: DMA: Fail safe if initialization fails (2011-02-23 14:06:03 -0800)

Mike Rapoport (3):
?ARM: tegra: PCIE minor code refactoring
?ARM: tegra: add PCI Express power gating
?ARM: tegra: trimslice: initialize PCI-e only when running on ? ?TrimSlice

Quoted 3 lines

?arch/arm/mach-tegra/board-trimslice.c | ? ?3 ++ ?arch/arm/mach-tegra/pcie.c ? ? ? ? ? ?| ? 38 ++++++++++++++++++++++++-------- ?2 files changed, 31 insertions(+), 10 deletions(-)

Ack - I put all 3 in tegra for-next. With these patches, I can boot my board with Trimslice and pci compiled in.