Commit f814430c authored by Stephen Warren's avatar Stephen Warren Committed by Bjorn Helgaas

PCI: tegra: Program PADS_REFCLK_CFG* registers with per-SoC values

The value that should be programmed into the PADS_REFCLK register varies
per SoC.  Fix the Tegra PCIe driver to program the correct values.  Future
SoCs will require different values in cfg0/1, so the two values are stored
separately in the per-SoC data structures.

For reference, the values are all documented in NV bug 1771116 comment 20.
The ASIC team has validated all these values, except for the Tegra20 value
which is simply left unchanged in this patch.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
parent cf5d3180
...@@ -228,15 +228,6 @@ ...@@ -228,15 +228,6 @@
#define PADS_REFCLK_CFG_PREDI_SHIFT 8 /* 11:8 */ #define PADS_REFCLK_CFG_PREDI_SHIFT 8 /* 11:8 */
#define PADS_REFCLK_CFG_DRVI_SHIFT 12 /* 15:12 */ #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 tegra_msi {
struct msi_controller chip; struct msi_controller chip;
DECLARE_BITMAP(used, INT_PCI_MSI_NR); DECLARE_BITMAP(used, INT_PCI_MSI_NR);
...@@ -252,6 +243,8 @@ struct tegra_pcie_soc_data { ...@@ -252,6 +243,8 @@ struct tegra_pcie_soc_data {
unsigned int msi_base_shift; unsigned int msi_base_shift;
u32 pads_pll_ctl; u32 pads_pll_ctl;
u32 tx_ref_sel; u32 tx_ref_sel;
u32 pads_refclk_cfg0;
u32 pads_refclk_cfg1;
bool has_pex_clkreq_en; bool has_pex_clkreq_en;
bool has_pex_bias_ctrl; bool has_pex_bias_ctrl;
bool has_intr_prsnt_sense; bool has_intr_prsnt_sense;
...@@ -923,7 +916,6 @@ static int tegra_pcie_phy_power_on(struct tegra_pcie *pcie) ...@@ -923,7 +916,6 @@ static int tegra_pcie_phy_power_on(struct tegra_pcie *pcie)
{ {
const struct tegra_pcie_soc_data *soc = pcie->soc_data; const struct tegra_pcie_soc_data *soc = pcie->soc_data;
struct tegra_pcie_port *port; struct tegra_pcie_port *port;
u32 value;
int err; int err;
if (pcie->legacy_phy) { if (pcie->legacy_phy) {
...@@ -949,11 +941,10 @@ static int tegra_pcie_phy_power_on(struct tegra_pcie *pcie) ...@@ -949,11 +941,10 @@ static int tegra_pcie_phy_power_on(struct tegra_pcie *pcie)
} }
/* Configure the reference clock driver */ /* Configure the reference clock driver */
value = PADS_REFCLK_CFG_VALUE | (PADS_REFCLK_CFG_VALUE << 16); pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
pads_writel(pcie, value, PADS_REFCLK_CFG0);
if (soc->num_ports > 2) if (soc->num_ports > 2)
pads_writel(pcie, PADS_REFCLK_CFG_VALUE, PADS_REFCLK_CFG1); pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
return 0; return 0;
} }
...@@ -2081,6 +2072,7 @@ static const struct tegra_pcie_soc_data tegra20_pcie_data = { ...@@ -2081,6 +2072,7 @@ static const struct tegra_pcie_soc_data tegra20_pcie_data = {
.msi_base_shift = 0, .msi_base_shift = 0,
.pads_pll_ctl = PADS_PLL_CTL_TEGRA20, .pads_pll_ctl = PADS_PLL_CTL_TEGRA20,
.tx_ref_sel = PADS_PLL_CTL_TXCLKREF_DIV10, .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_DIV10,
.pads_refclk_cfg0 = 0xfa5cfa5c,
.has_pex_clkreq_en = false, .has_pex_clkreq_en = false,
.has_pex_bias_ctrl = false, .has_pex_bias_ctrl = false,
.has_intr_prsnt_sense = false, .has_intr_prsnt_sense = false,
...@@ -2093,6 +2085,8 @@ static const struct tegra_pcie_soc_data tegra30_pcie_data = { ...@@ -2093,6 +2085,8 @@ static const struct tegra_pcie_soc_data tegra30_pcie_data = {
.msi_base_shift = 8, .msi_base_shift = 8,
.pads_pll_ctl = PADS_PLL_CTL_TEGRA30, .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
.tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN, .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
.pads_refclk_cfg0 = 0xfa5cfa5c,
.pads_refclk_cfg1 = 0xfa5cfa5c,
.has_pex_clkreq_en = true, .has_pex_clkreq_en = true,
.has_pex_bias_ctrl = true, .has_pex_bias_ctrl = true,
.has_intr_prsnt_sense = true, .has_intr_prsnt_sense = true,
...@@ -2105,6 +2099,7 @@ static const struct tegra_pcie_soc_data tegra124_pcie_data = { ...@@ -2105,6 +2099,7 @@ static const struct tegra_pcie_soc_data tegra124_pcie_data = {
.msi_base_shift = 8, .msi_base_shift = 8,
.pads_pll_ctl = PADS_PLL_CTL_TEGRA30, .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
.tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN, .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
.pads_refclk_cfg0 = 0x44ac44ac,
.has_pex_clkreq_en = true, .has_pex_clkreq_en = true,
.has_pex_bias_ctrl = true, .has_pex_bias_ctrl = true,
.has_intr_prsnt_sense = true, .has_intr_prsnt_sense = true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment