linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manikanta Maddireddy <mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Bjorn Helgaas <helgaas-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH V2 2/4] PCI: tegra: Add Tegra186 PCIe support
Date: Thu, 19 Oct 2017 12:21:27 +0530	[thread overview]
Message-ID: <a353d627-0155-a9b7-05f7-e689eddcdff3@nvidia.com> (raw)
In-Reply-To: <20171018162937.GA32397-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>



On 18-Oct-17 9:59 PM, Bjorn Helgaas wrote:
> On Wed, Oct 18, 2017 at 07:44:12PM +0530, Manikanta Maddireddy wrote:
>>
>>
>> On 18-Oct-17 6:57 PM, Bjorn Helgaas wrote:
>>> On Tue, Oct 17, 2017 at 10:27:49PM +0200, Thierry Reding wrote:
>>>> On Tue, Oct 17, 2017 at 12:34:28PM -0500, Bjorn Helgaas wrote:
>>>>> On Wed, Sep 27, 2017 at 05:28:35PM +0530, Manikanta Maddireddy wrote:
>>>>>> UPHY programming is performed by BPMP, PHY enable calls are
>>>>>> not required for Tegra186 PCIe. Power partition ungate is
>>>>>> done by BPMP powergate driver.
>>>>>>
>>>>>> Signed-off-by: Manikanta Maddireddy <mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>>> Reviewed-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>>> Tested-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>>> ---
>>>>>> V2: Add soc->program_uphy check for phy_exit call
>>>>>>  drivers/pci/host/pci-tegra.c | 132 +++++++++++++++++++++++++++++++++++--------
>>>>>>  1 file changed, 108 insertions(+), 24 deletions(-)
>>>>>
>>>>>> @@ -1012,10 +1016,12 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
>>>>>>  		afi_writel(pcie, value, AFI_FUSE);
>>>>>>  	}
>>>>>>  
>>>>>> -	err = tegra_pcie_phy_power_on(pcie);
>>>>>> -	if (err < 0) {
>>>>>> -		dev_err(dev, "failed to power on PHY(s): %d\n", err);
>>>>>> -		return err;
>>>>>> +	if (soc->program_uphy) {
>>>>>> +		err = tegra_pcie_phy_power_on(pcie);
>>>>>> +		if (err < 0) {
>>>>>> +			dev_err(dev, "failed to power on PHY(s): %d\n", err);
>>>>>> +			return err;
>>>>>> +		}
>>>>>
>>>>> This looks good: it's obvious that the previously-supported devices
>>>>> continue to work the same way because you set ".program_uphy = true"
>>>>> for them.  (It would be even more obvious if you changed the sense so
>>>>> that only the new device had to add this initializaer, but in general
>>>>> I prefer the positive logic as you have here, and I did verify that
>>>>> you added the initializer for all tegra_pcie_soc variants.)
>>>>>
>>>>>> @@ -1048,19 +1054,23 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
>>>>>>  static void tegra_pcie_power_off(struct tegra_pcie *pcie)
>>>>>>  {
>>>>>>  	struct device *dev = pcie->dev;
>>>>>> +	const struct tegra_pcie_soc *soc = pcie->soc;
>>>>>>  	int err;
>>>>>>  
>>>>>>  	/* TODO: disable and unprepare clocks? */
>>>>>>  
>>>>>> -	err = tegra_pcie_phy_power_off(pcie);
>>>>>> -	if (err < 0)
>>>>>> -		dev_err(dev, "failed to power off PHY(s): %d\n", err);
>>>>>> +	if (soc->program_uphy) {
>>>>>> +		err = tegra_pcie_phy_power_off(pcie);
>>>>>> +		if (err < 0)
>>>>>> +			dev_err(dev, "failed to power off PHY(s): %d\n", err);
>>>>>> +	}
>>>>>>  
>>>>>>  	reset_control_assert(pcie->pcie_xrst);
>>>>>>  	reset_control_assert(pcie->afi_rst);
>>>>>>  	reset_control_assert(pcie->pex_rst);
>>>>>>  
>>>>>> -	tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
>>>>>> +	if (!dev->pm_domain)
>>>>>> +		tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
>>>>>
>>>>> But this one isn't obvious because nothing in your patch obviously
>>>>> affects dev->pm_domain, so I can't tell whether this is safe.  It's
>>>>> worth a changelog comment to help justify this.
>>>>
>>>> The last sentence in the commit message is what this is about. Maybe it
>>>> should be more verbose:
>>>>
>>>> 	Since the BPMP controls the powergates on Tegra186, there is no
>>>> 	need to manually power on and off the PCIe power partition. The
>>>> 	BPMP generic power domain driver takes care of it instead.
>>>
>>> If you know Tegra intimately, maybe that clarifies it.  I don't, so my
>>> problem is that there's nothing in the patch that helps me verify
>>> this.  I infer that maybe there's something different in the DT that
>>> means dev->pm_domain will be set for Tegra186, but not for other
>>> variants?
>>>
>>> There should be something that helps the reader connect the dots.
>>
>> Till tegra210 pmc driver provides direct powergate power ON/OFF functions.
>>
>> In tegra186.dtsi power-domains property is added in pcie@10003000 DT node. reference: https://patchwork.ozlabs.org/patch/819113/
>> powergate-bpmp.c is the pm domain provider for pcie powergate. 
>> Platform driver will look for pm domain provider of Tegra pcie host driver and sets dev->pm_domains.
>> powergate-bpmp.c driver registers powergate power ON/OFF functions to generic PD power_on/powerr_off callback functions.
>> Generic power domain will take care of calling power_on before Tegra PCIe probe.
>>
>> So in this patch I used dev->pm_domain to skip pmc driver calls.
> 
> Thanks, I updated the changelog as follows:
> 
> 
> commit 9cea513d8cbc75ee26327d3d8971fe7b58288d8f
> Author: Manikanta Maddireddy <mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Date:   Wed Sep 27 17:28:35 2017 +0530
> 
>     PCI: tegra: Add Tegra186 PCIe support
>     
>     Add Tegra186 PCIe support.  UPHY programming is performed by BPMP; PHY
>     enable calls are not required for Tegra186 PCIe.
>     
>     Power partition ungate is done by BPMP powergate driver.  The Tegra186
>     DT description must include a "power-domains" property, which results in
>     dev->pm_domain being set.
> 
Thank you Bjorn

  parent reply	other threads:[~2017-10-19  6:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 11:58 [PATCH V2 0/4] Add Tegra186 PCIe support Manikanta Maddireddy
     [not found] ` <1506513517-25870-1-git-send-email-mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-09-27 11:58   ` [PATCH V2 1/4] dt-bindings: pci: tegra: Document Tegra186 PCIe DT Manikanta Maddireddy
     [not found]     ` <1506513517-25870-2-git-send-email-mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-13 16:37       ` Thierry Reding
2017-09-27 11:58   ` [PATCH V2 3/4] arm64: tegra: Add PCIe node for Tegra186 Manikanta Maddireddy
     [not found]     ` <1506513517-25870-4-git-send-email-mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-19 10:48       ` Thierry Reding
2017-09-27 11:58   ` [PATCH V2 4/4] arm64: tegra: Enable PCIe on Jetson TX2 Manikanta Maddireddy
     [not found]     ` <1506513517-25870-5-git-send-email-mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-19 10:49       ` Thierry Reding
2017-09-27 11:58 ` [PATCH V2 2/4] PCI: tegra: Add Tegra186 PCIe support Manikanta Maddireddy
     [not found]   ` <1506513517-25870-3-git-send-email-mmaddireddy-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-13 16:38     ` Thierry Reding
2017-10-17 17:34     ` Bjorn Helgaas
     [not found]       ` <20171017173428.GE5641-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-10-17 20:27         ` Thierry Reding
2017-10-18 13:27           ` Bjorn Helgaas
     [not found]             ` <20171018132752.GO5641-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-10-18 14:14               ` Manikanta Maddireddy
2017-10-18 16:29                 ` Bjorn Helgaas
     [not found]                   ` <20171018162937.GA32397-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-10-19  6:51                     ` Manikanta Maddireddy [this message]
2017-10-17 17:37 ` [PATCH V2 0/4] " Bjorn Helgaas
2017-10-17 20:28   ` Thierry Reding
2017-10-18  5:07     ` Manikanta Maddireddy

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=a353d627-0155-a9b7-05f7-e689eddcdff3@nvidia.com \
    --to=mmaddireddy-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=helgaas-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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).