From: Thierry Reding <thierry.reding@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
Stephen Warren <swarren@wwwdotorg.org>
Cc: Russell King <linux@arm.linux.org.uk>,
Jason Cooper <jason@lakedaemon.net>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Jay Agarwal <jagarwal@nvidia.com>,
linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v5 09/16] PCI: tegra: set up PADS_REFCLK_CFG1
Date: Thu, 25 Jul 2013 10:53:23 -0700 [thread overview]
Message-ID: <1374774810-18459-10-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1374774810-18459-1-git-send-email-thierry.reding@gmail.com>
From: Stephen Warren <swarren@nvidia.com>
The registers PADS_REFCLK_CFG are an array of 16-bit data, one entry per
PCIe root port. For Tegra30, we therefore need to write a 3rd entry in
this array. Doing so mays the mini-PCIe slot on Beaver operate correctly.
While we're at it, add some #defines to partially document the fields
within these 16-bit values.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/pci/host/pci-tegra.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 5347d7d..0c84c67 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -196,6 +196,25 @@
#define PADS_REFCLK_CFG0 0x000000C8
#define PADS_REFCLK_CFG1 0x000000CC
+/*
+ * Fields in PADS_REFCLK_CFG*. Those registers form an array of 16-bit
+ * entries, one entry per PCIe port. These field definitions and desired
+ * values aren't in the TRM, but do come from NVIDIA.
+ */
+#define PADS_REFCLK_CFG_TERM_SHIFT 2 /* 6:2 */
+#define PADS_REFCLK_CFG_E_TERM_SHIFT 7
+#define PADS_REFCLK_CFG_PREDI_SHIFT 8 /* 11:8 */
+#define PADS_REFCLK_CFG_DRVI_SHIFT 12 /* 15:12 */
+
+/* Default value provided by HW engineering is 0xfa5c */
+#define PADS_REFCLK_CFG_VALUE \
+ ( \
+ (0x17 << PADS_REFCLK_CFG_TERM_SHIFT) | \
+ (0 << PADS_REFCLK_CFG_E_TERM_SHIFT) | \
+ (0xa << PADS_REFCLK_CFG_PREDI_SHIFT) | \
+ (0xf << PADS_REFCLK_CFG_DRVI_SHIFT) \
+ )
+
struct tegra_msi {
struct msi_chip chip;
DECLARE_BITMAP(used, INT_PCI_MSI_NR);
@@ -809,11 +828,11 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
value |= PADS_PLL_CTL_RST_B4SM;
pads_writel(pcie, value, soc->pads_pll_ctl);
- /*
- * Hack, set the clock voltage to the DEFAULT provided by hw folks.
- * This doesn't exist in the documentation.
- */
- pads_writel(pcie, 0xfa5cfa5c, PADS_REFCLK_CFG0);
+ /* Configure the reference clock driver */
+ value = PADS_REFCLK_CFG_VALUE | (PADS_REFCLK_CFG_VALUE << 16);
+ pads_writel(pcie, value, PADS_REFCLK_CFG0);
+ if (soc->num_ports > 2)
+ pads_writel(pcie, PADS_REFCLK_CFG_VALUE, PADS_REFCLK_CFG1);
/* wait for the PLL to lock */
timeout = 300;
--
1.8.1.5
next prev parent reply other threads:[~2013-07-25 17:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 17:53 [PATCH v5 00/16] Rewrite Tegra PCIe driver Thierry Reding
2013-07-25 17:53 ` [PATCH v5 01/16] ARM: tegra: Move tegra_pcie_xclk_clamp() to PMC Thierry Reding
2013-07-25 17:53 ` [PATCH v5 03/16] PCI: tegra: Move PCIe driver to drivers/pci/host Thierry Reding
[not found] ` <1374774810-18459-4-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-25 18:00 ` Bjorn Helgaas
2013-07-25 17:53 ` [PATCH v5 04/16] ARM: tegra: tamonten: Add PCIe support Thierry Reding
2013-07-25 17:53 ` [PATCH v5 05/16] ARM: tegra: tec: " Thierry Reding
2013-07-25 17:53 ` [PATCH v5 06/16] ARM: tegra: harmony: Initialize PCIe from DT Thierry Reding
[not found] ` <1374774810-18459-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-25 17:53 ` [PATCH v5 02/16] ARM: tegra: Move pmc.h to include/linux/tegra-pmc.h Thierry Reding
2013-07-25 17:53 ` [PATCH v5 07/16] ARM: tegra: trimslice: Initialize PCIe from DT Thierry Reding
2013-07-25 17:53 ` [PATCH v5 08/16] PCI: tegra: Add Tegra 30 PCIe support Thierry Reding
2013-07-25 18:00 ` Bjorn Helgaas
2013-07-25 17:53 ` Thierry Reding [this message]
2013-07-25 18:01 ` [PATCH v5 09/16] PCI: tegra: set up PADS_REFCLK_CFG1 Bjorn Helgaas
2013-07-25 17:53 ` [PATCH v5 10/16] ARM: tegra: Add Tegra30 PCIe support Thierry Reding
2013-07-25 17:53 ` [PATCH v5 11/16] ARM: tegra: Enable PCIe controller on Cardhu Thierry Reding
2013-07-25 17:53 ` [PATCH v5 12/16] ARM: tegra: Enable PCIe controller on Beaver Thierry Reding
2013-07-25 17:53 ` [PATCH v5 13/16] ARM: tegra: Fix Beaver's PCIe lane configuration Thierry Reding
2013-07-25 17:53 ` [PATCH v5 14/16] ARM: tegra: Update default configuration (PCIe) Thierry Reding
2013-07-25 17:53 ` [PATCH v5 15/16] ARM: dts: tegra: Increase prefetchable PCI memory space Thierry Reding
2013-07-25 17:53 ` [PATCH v5 16/16] MAINTAINERS: Add myself as Tegra PCIe maintainer Thierry Reding
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=1374774810-18459-10-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=jagarwal@nvidia.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=swarren@wwwdotorg.org \
--cc=thomas.petazzoni@free-electrons.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