All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
@ 2016-06-24 14:37 ` Stephen Warren
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2016-06-24 14:37 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Alexandre Courbot,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
code to tegra_pcie_port_enable() instead.

For reference, NVIDIA's downstream Linux kernel performs this operation
in tegra_pcie_enable_rp_features(), which is called immediately after
tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/pci/host/pci-tegra.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 74887fedc3d4..2ec64a9e7943 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -541,12 +541,13 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
 
 static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 {
-	const struct tegra_pcie_soc_data *soc = port->pcie->soc_data;
+	struct tegra_pcie *pcie = port->pcie;
+	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
 	unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
 	unsigned long value;
 
 	/* enable reference clock */
-	value = afi_readl(port->pcie, ctrl);
+	value = afi_readl(pcie, ctrl);
 	value |= AFI_PEX_CTRL_REFCLK_EN;
 
 	if (soc->has_pex_clkreq_en)
@@ -554,9 +555,14 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 
 	value |= AFI_PEX_CTRL_OVERRIDE_EN;
 
-	afi_writel(port->pcie, value, ctrl);
+	afi_writel(pcie, value, ctrl);
 
 	tegra_pcie_port_reset(port);
+
+	/* Configure the reference clock driver */
+	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
+	if (soc->num_ports > 2)
+		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
 }
 
 static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
@@ -831,11 +837,6 @@ static int tegra_pcie_phy_enable(struct tegra_pcie *pcie)
 	value |= PADS_PLL_CTL_RST_B4SM;
 	pads_writel(pcie, value, soc->pads_pll_ctl);
 
-	/* Configure the reference clock driver */
-	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
-	if (soc->num_ports > 2)
-		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
-
 	/* wait for the PLL to lock */
 	err = tegra_pcie_pll_wait(pcie, 500);
 	if (err < 0) {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
@ 2016-06-24 14:37 ` Stephen Warren
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2016-06-24 14:37 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
code to tegra_pcie_port_enable() instead.

For reference, NVIDIA's downstream Linux kernel performs this operation
in tegra_pcie_enable_rp_features(), which is called immediately after
tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/pci/host/pci-tegra.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 74887fedc3d4..2ec64a9e7943 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -541,12 +541,13 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
 
 static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 {
-	const struct tegra_pcie_soc_data *soc = port->pcie->soc_data;
+	struct tegra_pcie *pcie = port->pcie;
+	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
 	unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
 	unsigned long value;
 
 	/* enable reference clock */
-	value = afi_readl(port->pcie, ctrl);
+	value = afi_readl(pcie, ctrl);
 	value |= AFI_PEX_CTRL_REFCLK_EN;
 
 	if (soc->has_pex_clkreq_en)
@@ -554,9 +555,14 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 
 	value |= AFI_PEX_CTRL_OVERRIDE_EN;
 
-	afi_writel(port->pcie, value, ctrl);
+	afi_writel(pcie, value, ctrl);
 
 	tegra_pcie_port_reset(port);
+
+	/* Configure the reference clock driver */
+	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
+	if (soc->num_ports > 2)
+		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
 }
 
 static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
@@ -831,11 +837,6 @@ static int tegra_pcie_phy_enable(struct tegra_pcie *pcie)
 	value |= PADS_PLL_CTL_RST_B4SM;
 	pads_writel(pcie, value, soc->pads_pll_ctl);
 
-	/* Configure the reference clock driver */
-	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
-	if (soc->num_ports > 2)
-		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
-
 	/* wait for the PLL to lock */
 	err = tegra_pcie_pll_wait(pcie, 500);
 	if (err < 0) {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
  2016-06-24 14:37 ` Stephen Warren
@ 2016-06-26  2:54     ` Simon Glass
  -1 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2016-06-26  2:54 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Thierry Reding, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	Alexandre Courbot, Stephen Warren, lak

On 24 June 2016 at 08:37, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
> tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
> part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
> code to tegra_pcie_port_enable() instead.
>
> For reference, NVIDIA's downstream Linux kernel performs this operation
> in tegra_pcie_enable_rp_features(), which is called immediately after
> tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
> driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.
>
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/pci/host/pci-tegra.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)

Reviewed-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
@ 2016-06-26  2:54     ` Simon Glass
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2016-06-26  2:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 24 June 2016 at 08:37, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
> tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
> part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
> code to tegra_pcie_port_enable() instead.
>
> For reference, NVIDIA's downstream Linux kernel performs this operation
> in tegra_pcie_enable_rp_features(), which is called immediately after
> tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
> driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  drivers/pci/host/pci-tegra.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
  2016-06-24 14:37 ` Stephen Warren
@ 2016-06-30 13:47   ` Thierry Reding
  -1 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2016-06-30 13:47 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-tegra, Alexandre Courbot, Stephen Warren, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2773 bytes --]

On Fri, Jun 24, 2016 at 08:37:03AM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
> tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
> part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
> code to tegra_pcie_port_enable() instead.
> 
> For reference, NVIDIA's downstream Linux kernel performs this operation
> in tegra_pcie_enable_rp_features(), which is called immediately after
> tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
> driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  drivers/pci/host/pci-tegra.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> index 74887fedc3d4..2ec64a9e7943 100644
> --- a/drivers/pci/host/pci-tegra.c
> +++ b/drivers/pci/host/pci-tegra.c
> @@ -541,12 +541,13 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
>  
>  static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>  {
> -	const struct tegra_pcie_soc_data *soc = port->pcie->soc_data;
> +	struct tegra_pcie *pcie = port->pcie;
> +	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
>  	unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
>  	unsigned long value;
>  
>  	/* enable reference clock */
> -	value = afi_readl(port->pcie, ctrl);
> +	value = afi_readl(pcie, ctrl);
>  	value |= AFI_PEX_CTRL_REFCLK_EN;
>  
>  	if (soc->has_pex_clkreq_en)
> @@ -554,9 +555,14 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>  
>  	value |= AFI_PEX_CTRL_OVERRIDE_EN;
>  
> -	afi_writel(port->pcie, value, ctrl);
> +	afi_writel(pcie, value, ctrl);
>  
>  	tegra_pcie_port_reset(port);
> +
> +	/* Configure the reference clock driver */
> +	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
> +	if (soc->num_ports > 2)
> +		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
>  }

This will actually write these two registers for each enabled port,
which, while it shouldn't make a difference, is unnecessary. I've
applied a slightly modified version of this patch. Specifically I moved
this code to the tail of the tegra_pcie_phy_power_on() function, which
is closest to where it was before.

I've also applied the patch that changes the values that are written
into this register, though I reversed the order because that made more
sense to me. I've pushed both patches to the for-4.8/pci branch in the
Tegra tree, can you please take a look if that still looks okay to you?

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
@ 2016-06-30 13:47   ` Thierry Reding
  0 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2016-06-30 13:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 24, 2016 at 08:37:03AM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
> tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
> part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
> code to tegra_pcie_port_enable() instead.
> 
> For reference, NVIDIA's downstream Linux kernel performs this operation
> in tegra_pcie_enable_rp_features(), which is called immediately after
> tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
> driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  drivers/pci/host/pci-tegra.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> index 74887fedc3d4..2ec64a9e7943 100644
> --- a/drivers/pci/host/pci-tegra.c
> +++ b/drivers/pci/host/pci-tegra.c
> @@ -541,12 +541,13 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
>  
>  static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>  {
> -	const struct tegra_pcie_soc_data *soc = port->pcie->soc_data;
> +	struct tegra_pcie *pcie = port->pcie;
> +	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
>  	unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
>  	unsigned long value;
>  
>  	/* enable reference clock */
> -	value = afi_readl(port->pcie, ctrl);
> +	value = afi_readl(pcie, ctrl);
>  	value |= AFI_PEX_CTRL_REFCLK_EN;
>  
>  	if (soc->has_pex_clkreq_en)
> @@ -554,9 +555,14 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>  
>  	value |= AFI_PEX_CTRL_OVERRIDE_EN;
>  
> -	afi_writel(port->pcie, value, ctrl);
> +	afi_writel(pcie, value, ctrl);
>  
>  	tegra_pcie_port_reset(port);
> +
> +	/* Configure the reference clock driver */
> +	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
> +	if (soc->num_ports > 2)
> +		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
>  }

This will actually write these two registers for each enabled port,
which, while it shouldn't make a difference, is unnecessary. I've
applied a slightly modified version of this patch. Specifically I moved
this code to the tail of the tegra_pcie_phy_power_on() function, which
is closest to where it was before.

I've also applied the patch that changes the values that are written
into this register, though I reversed the order because that made more
sense to me. I've pushed both patches to the for-4.8/pci branch in the
Tegra tree, can you please take a look if that still looks okay to you?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160630/a8b7fa3d/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
  2016-06-30 13:47   ` Thierry Reding
@ 2016-06-30 15:49     ` Stephen Warren
  -1 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2016-06-30 15:49 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Alexandre Courbot, Stephen Warren, linux-arm-kernel

On 06/30/2016 07:47 AM, Thierry Reding wrote:
> On Fri, Jun 24, 2016 at 08:37:03AM -0600, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
>> tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
>> part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
>> code to tegra_pcie_port_enable() instead.
>>
>> For reference, NVIDIA's downstream Linux kernel performs this operation
>> in tegra_pcie_enable_rp_features(), which is called immediately after
>> tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
>> driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>>   drivers/pci/host/pci-tegra.c | 17 +++++++++--------
>>   1 file changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
>> index 74887fedc3d4..2ec64a9e7943 100644
>> --- a/drivers/pci/host/pci-tegra.c
>> +++ b/drivers/pci/host/pci-tegra.c
>> @@ -541,12 +541,13 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
>>
>>   static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>>   {
>> -	const struct tegra_pcie_soc_data *soc = port->pcie->soc_data;
>> +	struct tegra_pcie *pcie = port->pcie;
>> +	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
>>   	unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
>>   	unsigned long value;
>>
>>   	/* enable reference clock */
>> -	value = afi_readl(port->pcie, ctrl);
>> +	value = afi_readl(pcie, ctrl);
>>   	value |= AFI_PEX_CTRL_REFCLK_EN;
>>
>>   	if (soc->has_pex_clkreq_en)
>> @@ -554,9 +555,14 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>>
>>   	value |= AFI_PEX_CTRL_OVERRIDE_EN;
>>
>> -	afi_writel(port->pcie, value, ctrl);
>> +	afi_writel(pcie, value, ctrl);
>>
>>   	tegra_pcie_port_reset(port);
>> +
>> +	/* Configure the reference clock driver */
>> +	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
>> +	if (soc->num_ports > 2)
>> +		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
>>   }
>
> This will actually write these two registers for each enabled port,
> which, while it shouldn't make a difference, is unnecessary. I've
> applied a slightly modified version of this patch. Specifically I moved
> this code to the tail of the tegra_pcie_phy_power_on() function, which
> is closest to where it was before.
>
> I've also applied the patch that changes the values that are written
> into this register, though I reversed the order because that made more
> sense to me. I've pushed both patches to the for-4.8/pci branch in the
> Tegra tree, can you please take a look if that still looks okay to you?

I think that will work. It's a pity the code location in the mainline 
kernel is going to diverge from the downstream kernel and U-Boot though.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs
@ 2016-06-30 15:49     ` Stephen Warren
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2016-06-30 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/30/2016 07:47 AM, Thierry Reding wrote:
> On Fri, Jun 24, 2016 at 08:37:03AM -0600, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> On recent SoCs, tegra_pcie_phy_enable() isn't called; but instead
>> tegra_pcie_enable_controller() calls tegra_xusb_phy_enable(). However,
>> part of tegra_pcie_phy_enable() needs to happen in all cases. Move that
>> code to tegra_pcie_port_enable() instead.
>>
>> For reference, NVIDIA's downstream Linux kernel performs this operation
>> in tegra_pcie_enable_rp_features(), which is called immediately after
>> tegra_pcie_port_enable(). Since that function doesn't exist in the mainline
>> driver, we'll just add it to the tail of tegra_pcie_port_enable() instead.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>>   drivers/pci/host/pci-tegra.c | 17 +++++++++--------
>>   1 file changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
>> index 74887fedc3d4..2ec64a9e7943 100644
>> --- a/drivers/pci/host/pci-tegra.c
>> +++ b/drivers/pci/host/pci-tegra.c
>> @@ -541,12 +541,13 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
>>
>>   static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>>   {
>> -	const struct tegra_pcie_soc_data *soc = port->pcie->soc_data;
>> +	struct tegra_pcie *pcie = port->pcie;
>> +	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
>>   	unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
>>   	unsigned long value;
>>
>>   	/* enable reference clock */
>> -	value = afi_readl(port->pcie, ctrl);
>> +	value = afi_readl(pcie, ctrl);
>>   	value |= AFI_PEX_CTRL_REFCLK_EN;
>>
>>   	if (soc->has_pex_clkreq_en)
>> @@ -554,9 +555,14 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
>>
>>   	value |= AFI_PEX_CTRL_OVERRIDE_EN;
>>
>> -	afi_writel(port->pcie, value, ctrl);
>> +	afi_writel(pcie, value, ctrl);
>>
>>   	tegra_pcie_port_reset(port);
>> +
>> +	/* Configure the reference clock driver */
>> +	pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
>> +	if (soc->num_ports > 2)
>> +		pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
>>   }
>
> This will actually write these two registers for each enabled port,
> which, while it shouldn't make a difference, is unnecessary. I've
> applied a slightly modified version of this patch. Specifically I moved
> this code to the tail of the tegra_pcie_phy_power_on() function, which
> is closest to where it was before.
>
> I've also applied the patch that changes the values that are written
> into this register, though I reversed the order because that made more
> sense to me. I've pushed both patches to the for-4.8/pci branch in the
> Tegra tree, can you please take a look if that still looks okay to you?

I think that will work. It's a pity the code location in the mainline 
kernel is going to diverge from the downstream kernel and U-Boot though.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-06-30 15:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 14:37 [PATCH] pci: tegra: actually program REFCLK_CFG* on recent SoCs Stephen Warren
2016-06-24 14:37 ` Stephen Warren
     [not found] ` <20160624143703.13231-1-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2016-06-26  2:54   ` Simon Glass
2016-06-26  2:54     ` Simon Glass
2016-06-30 13:47 ` Thierry Reding
2016-06-30 13:47   ` Thierry Reding
2016-06-30 15:49   ` Stephen Warren
2016-06-30 15:49     ` Stephen Warren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.