From: Thierry Reding <thierry.reding@avionic-design.de>
To: linux-tegra@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org,
Grant Likely <grant.likely@secretlab.ca>,
Rob Herring <rob.herring@calxeda.com>,
devicetree-discuss@lists.ozlabs.org,
Russell King <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
Colin Cross <ccross@android.com>, Olof Johansson <olof@lixom.net>,
Stephen Warren <swarren@wwwdotorg.org>,
Mitch Bradley <wmb@firmworks.com>, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH v3 04/10] ARM: tegra: Move tegra_pcie_xclk_clamp() to PMC
Date: Thu, 26 Jul 2012 21:55:06 +0200 [thread overview]
Message-ID: <1343332512-28762-5-git-send-email-thierry.reding@avionic-design.de> (raw)
In-Reply-To: <1343332512-28762-1-git-send-email-thierry.reding@avionic-design.de>
The PMC code already accesses to PMC registers so it makes sense to
move this function there as well. While at it, rename the function to
tegra_pmc_pcie_xclk_clamp() for consistency.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
---
Changes in v3:
- none
Changes in v2:
- none
arch/arm/mach-tegra/pcie.c | 30 ++++--------------------------
arch/arm/mach-tegra/pmc.c | 16 ++++++++++++++++
arch/arm/mach-tegra/pmc.h | 1 +
3 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index 576347a..efe71dd 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -42,6 +42,7 @@
#include <mach/powergate.h>
#include "board.h"
+#include "pmc.h"
/* register definitions */
#define AFI_OFFSET 0x3800
@@ -145,17 +146,6 @@
#define PADS_PLL_CTL_TXCLKREF_DIV10 (0 << 20)
#define PADS_PLL_CTL_TXCLKREF_DIV5 (1 << 20)
-/* PMC access is required for PCIE xclk (un)clamping */
-#define PMC_SCRATCH42 0x144
-#define PMC_SCRATCH42_PCX_CLAMP (1 << 0)
-
-static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);
-
-#define pmc_writel(value, reg) \
- __raw_writel(value, reg_pmc_base + (reg))
-#define pmc_readl(reg) \
- __raw_readl(reg_pmc_base + (reg))
-
/*
* Tegra2 defines 1GB in the AXI address map for PCIe.
*
@@ -647,18 +637,6 @@ static int tegra_pcie_enable_controller(void)
return 0;
}
-static void tegra_pcie_xclk_clamp(bool clamp)
-{
- u32 reg;
-
- reg = pmc_readl(PMC_SCRATCH42) & ~PMC_SCRATCH42_PCX_CLAMP;
-
- if (clamp)
- reg |= PMC_SCRATCH42_PCX_CLAMP;
-
- pmc_writel(reg, PMC_SCRATCH42);
-}
-
static void tegra_pcie_power_off(void)
{
tegra_periph_reset_assert(tegra_pcie.pcie_xclk);
@@ -666,7 +644,7 @@ static void tegra_pcie_power_off(void)
tegra_periph_reset_assert(tegra_pcie.pex_clk);
tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
- tegra_pcie_xclk_clamp(true);
+ tegra_pmc_pcie_xclk_clamp(true);
}
static int tegra_pcie_power_regate(void)
@@ -675,7 +653,7 @@ static int tegra_pcie_power_regate(void)
tegra_pcie_power_off();
- tegra_pcie_xclk_clamp(true);
+ tegra_pmc_pcie_xclk_clamp(true);
tegra_periph_reset_assert(tegra_pcie.pcie_xclk);
tegra_periph_reset_assert(tegra_pcie.afi_clk);
@@ -689,7 +667,7 @@ static int tegra_pcie_power_regate(void)
tegra_periph_reset_deassert(tegra_pcie.afi_clk);
- tegra_pcie_xclk_clamp(false);
+ tegra_pmc_pcie_xclk_clamp(false);
clk_prepare_enable(tegra_pcie.afi_clk);
clk_prepare_enable(tegra_pcie.pex_clk);
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 7af6a54..399dc3a 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -24,6 +24,10 @@
#define PMC_CTRL 0x0
#define PMC_CTRL_INTR_LOW (1 << 17)
+/* PMC access is required for PCIE xclk (un)clamping */
+#define PMC_SCRATCH42 0x144
+#define PMC_SCRATCH42_PCX_CLAMP (1 << 0)
+
static inline u32 tegra_pmc_readl(u32 reg)
{
return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg));
@@ -74,3 +78,15 @@ void __init tegra_pmc_init(void)
val &= ~PMC_CTRL_INTR_LOW;
tegra_pmc_writel(val, PMC_CTRL);
}
+
+void tegra_pmc_pcie_xclk_clamp(bool clamp)
+{
+ u32 reg;
+
+ reg = tegra_pmc_readl(PMC_SCRATCH42) & ~PMC_SCRATCH42_PCX_CLAMP;
+
+ if (clamp)
+ reg |= PMC_SCRATCH42_PCX_CLAMP;
+
+ tegra_pmc_writel(reg, PMC_SCRATCH42);
+}
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h
index 8995ee4..2631c9a 100644
--- a/arch/arm/mach-tegra/pmc.h
+++ b/arch/arm/mach-tegra/pmc.h
@@ -19,5 +19,6 @@
#define __MACH_TEGRA_PMC_H
void tegra_pmc_init(void);
+void tegra_pmc_pcie_xclk_clamp(bool clamp);
#endif
--
1.7.11.2
next prev parent reply other threads:[~2012-07-26 19:55 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 19:55 [PATCH v3 00/10] ARM: tegra: Add PCIe device tree support Thierry Reding
2012-07-26 19:55 ` [PATCH v3 01/10] PCI: Keep pci_fixup_irqs() around after init Thierry Reding
2012-08-14 5:06 ` Bjorn Helgaas
2012-08-14 5:37 ` Thierry Reding
2012-08-15 17:06 ` Bjorn Helgaas
2012-08-15 19:28 ` Thierry Reding
2012-08-15 19:42 ` Bjorn Helgaas
2012-08-15 20:01 ` Thierry Reding
2012-09-07 16:19 ` Stephen Warren
2012-09-07 17:00 ` Thierry Reding
2012-09-07 17:22 ` Bjorn Helgaas
2012-09-14 18:55 ` Thierry Reding
2012-09-14 19:45 ` Bjorn Helgaas
2012-07-26 19:55 ` [PATCH v3 02/10] ARM: pci: Keep pci_common_init() " Thierry Reding
2012-07-26 19:55 ` [PATCH v3 03/10] ARM: pci: Allow passing per-controller private data Thierry Reding
2012-07-26 19:55 ` Thierry Reding [this message]
2012-07-26 19:55 ` [PATCH v3 05/10] resource: add PCI configuration space support Thierry Reding
2012-08-14 5:00 ` Bjorn Helgaas
2012-08-14 5:55 ` Thierry Reding
2012-08-14 17:38 ` Bjorn Helgaas
2012-08-14 18:01 ` Thierry Reding
2012-08-14 21:44 ` Bjorn Helgaas
2012-08-15 6:49 ` Thierry Reding
2012-08-16 15:18 ` Stephen Warren
2012-08-16 18:27 ` Thierry Reding
2012-07-26 19:55 ` [PATCH v3 06/10] ARM: tegra: Rewrite PCIe support as a driver Thierry Reding
2012-07-26 19:55 ` [PATCH v3 07/10] ARM: tegra: pcie: Add MSI support Thierry Reding
2012-07-26 19:55 ` [PATCH v3 08/10] of/address: Handle #address-cells > 2 specially Thierry Reding
2012-07-31 20:18 ` Rob Herring
2012-08-15 20:06 ` Thierry Reding
2012-09-07 16:24 ` Stephen Warren
2012-09-07 16:32 ` Rob Herring
2012-07-26 19:55 ` [PATCH v3 09/10] of: Add of_pci_parse_ranges() Thierry Reding
2012-07-31 20:07 ` Rob Herring
2012-08-01 6:54 ` Thierry Reding
2012-08-01 16:07 ` Stephen Warren
2012-07-26 19:55 ` [PATCH v3 10/10] ARM: tegra: pcie: Add device tree support Thierry Reding
2012-08-14 20:12 ` Thierry Reding
2012-08-14 23:50 ` Bjorn Helgaas
2012-08-15 6:37 ` Thierry Reding
2012-08-15 12:18 ` Bjorn Helgaas
2012-08-15 12:30 ` Thierry Reding
2012-08-15 14:36 ` Bjorn Helgaas
2012-08-15 14:57 ` Thierry Reding
2012-08-15 20:25 ` Arnd Bergmann
2012-08-15 20:48 ` Bjorn Helgaas
2012-08-16 4:55 ` Thierry Reding
2012-08-16 7:03 ` Arnd Bergmann
2012-08-16 7:47 ` Thierry Reding
2012-08-16 12:15 ` Thierry Reding
2012-07-31 16:18 ` [PATCH v3 00/10] ARM: tegra: Add PCIe " Stephen Warren
2012-08-01 6:35 ` Thierry Reding
2012-08-01 17:02 ` Stephen Warren
2012-08-02 6:15 ` Thierry Reding
2012-08-06 19:42 ` Stephen Warren
2012-08-07 18:20 ` Thierry Reding
2012-08-13 17:40 ` Thierry Reding
2012-08-13 18:47 ` Stephen Warren
2012-08-13 20:33 ` Thierry Reding
2012-08-13 21:38 ` Rob Herring
2012-08-14 6:14 ` Thierry Reding
2012-08-13 23:18 ` Bjorn Helgaas
2012-08-14 6:29 ` Thierry Reding
2012-08-14 19:39 ` Stephen Warren
2012-08-14 19:58 ` Thierry Reding
2012-08-14 21:55 ` Bjorn Helgaas
2012-08-14 22:58 ` Stephen Warren
2012-08-14 23:51 ` Stephen Warren
2012-08-15 19:04 ` Stephen Warren
2012-08-15 20:09 ` Thierry Reding
2012-08-15 20:11 ` Stephen Warren
2012-08-15 20:19 ` Thierry Reding
2012-09-07 23:34 ` Stephen Warren
2012-09-08 0:04 ` Russell King - ARM Linux
2012-09-08 5:53 ` Stephen Warren
2012-09-08 17:51 ` Bjorn Helgaas
2012-09-18 6:33 ` Thierry Reding
2012-09-18 15:56 ` Bjorn Helgaas
2012-08-15 0:08 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343332512-28762-5-git-send-email-thierry.reding@avionic-design.de \
--to=thierry.reding@avionic-design.de \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=ccross@android.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=olof@lixom.net \
--cc=rob.herring@calxeda.com \
--cc=swarren@wwwdotorg.org \
--cc=wmb@firmworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).