linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Rob Herring <robh+dt@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Bjorn Helgaas <helgaas@kernel.org>,
	Andy Gross <agross@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Stanimir Varbanov <svarbanov@mm-sol.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	PCI <linux-pci@vger.kernel.org>,
	Kalle Valo <kvalo@codeaurora.org>
Subject: Re: [PATCH v2 3/5] pcie-qcom: provide a way to power up qca6390 chip on RB5 platform
Date: Wed, 3 Feb 2021 07:14:30 +0300	[thread overview]
Message-ID: <CAA8EJpq6A28RHSD7YVz_AAdWnnvtCEAh1XcPyUTu0Ufp67M1XA@mail.gmail.com> (raw)
In-Reply-To: <CAL_JsqJoKEVUs0f7rP87M3Wh6yVvB-bYi7vBprti8hoim3-e-A@mail.gmail.com>

On Wed, 3 Feb 2021 at 00:37, Rob Herring <robh+dt@kernel.org> wrote:
>
> On Tue, Feb 2, 2021 at 1:48 PM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > On Sat 30 Jan 10:14 CST 2021, Dmitry Baryshkov wrote:
> >
> > > On Sat, 30 Jan 2021 at 06:53, Bjorn Andersson
> > > <bjorn.andersson@linaro.org> wrote:
> > > >
> > > > On Fri 29 Jan 16:19 CST 2021, Dmitry Baryshkov wrote:
> > > >
> > > > > On Sat, 30 Jan 2021 at 00:50, Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > > > >
> > > > > > On Fri, Jan 29, 2021 at 06:45:21AM +0300, Dmitry Baryshkov wrote:
> > > > > > > On 28/01/2021 22:26, Rob Herring wrote:
> > > > > > > > On Thu, Jan 28, 2021 at 11:52 AM Dmitry Baryshkov
> > > > > > > > <dmitry.baryshkov@linaro.org> wrote:
> > > > > > > > >
> > > > > > > > > Some Qualcomm platforms require to power up an external device before
> > > > > > > > > probing the PCI bus. E.g. on RB5 platform the QCA6390 WiFi/BT chip needs
> > > > > > > > > to be powered up before PCIe0 bus is probed. Add a quirk to the
> > > > > > > > > respective PCIe root bridge to attach to the power domain if one is
> > > > > > > > > required, so that the QCA chip is started before scanning the PCIe bus.
> > > > > > > >
> > > > > > > > This is solving a generic problem in a specific driver. It needs to be
> > > > > > > > solved for any PCI host and any device.
> > > > > > >
> > > > > > > Ack. I see your point here.
> > > > > > >
> > > > > > > As this would require porting code from powerpc/spark of-pci code and
> > > > > > > changing pcie port driver to apply power supply before bus probing happens,
> > > > > > > I'd also ask for the comments from PCI maintainers. Will that solution be
> > > > > > > acceptable to you?
> > > > > >
> > > > > > I can't say without seeing the code.  I don't know enough about this
> > > > > > scenario to envision how it might look.
> > > > > >
> > > > > > I guess the QCA6390 is a PCIe device?  Why does it need to be powered
> > > > > > up before probing?  Shouldn't we get a link-up interrupt when it is
> > > > > > powered up so we could probe it then?
> > > > >
> > > > > Not quite. QCA6390 is a multifunction device, with PCIe and serial
> > > > > parts. It has internal power regulators which once enabled will
> > > > > powerup the PCIe, serial and radio parts. There is no need to manage
> > > > > regulators. Once enabled they will automatically handle device
> > > > > suspend/resume, etc.
> > > > >
> > > >
> > > > So what you're saying is that if either the PCI controller or bluetooth
> > > > driver probes these regulators will be turned on, indefinitely?
> > > >
> > > > If so, why do we need a driver to turn them on, rather than just mark
> > > > them as always-on?
> > > >
> > > > What's the timing requirement wrt regulators vs WL_EN/BT_EN?
> > >
> > > According to the documentation I have, they must be enabled right
> > > after enabling powering the chip and they must stay enabled all the
> > > time.
> > >
> >
> > So presumably just marking these things always-on and flipping the GPIO
> > statically won't be good enough due to the lack of control over the
> > timing.
> >
> > This really do look like a simplified case of what we see with the
> > PCIe attached modems, where similar requirements are provided, but also
> > the ability to perform a device specific reset sequence in case the
> > hardware has locked up. I'm slightly worried about the ability of
> > extending your power-domain model to handle the restart operation
> > though.
>
> I think this is an abuse of 'power-domains'. Just define the
> regulators in both WiFi and BT nodes and have each driver enable them.

I think it is too late to enable regulators in the WiFi driver. Even
if I modify the/pci code to register devices basing on the OF nodes
(like we do for PPC and Sparc), necessary link training/hotplug
handling should happen outside of the WiFi driver.

> They're refcounted. If that's still not enough control over the power
> sequencing, then create a 3rd entity to do it, but that doesn't need
> to leak into DT. You already have all the information you need.

From my point of view the proposed design (with three nodes) exactly
represents the hardware: the power-handling part, the WiFi part and
the BT part. If you don't like the power domains, would regulators be
better from your point of view? The "power" device providing a
regulator to be used by the child nodes. For the BT part the regulator
is fine, while for the WiFi...

The major problem with regulators in this case is that they are
typically enabled by the device driver itself, rather than by parent
device/bus code. And in the WiFi driver case the WiFi chip should be
already up and running before probing the ath11k driver.

Maybe it would still be better to take a step back and just introduce
'vcc-child-supply' entry to the pcie-qcom device tree node or to the
PCIe bridge node? This would also cover cases of PCIe mezzanine boards
when the on-mezzanine devices are visible through the PCIe bus, but
the mezzanine is powered by a separate voltage regulator. It would not
be possible to describe child devices in the device tree node, but
rather it would be possible to describe that there might be devices
behind the PCIe bridge, they must be powered on using a referenced
regulator. This starts to sound like a kind of PCI hotplug.

This would result in the following nodes:

pcie0: pci@1c0000 {
   compatible = "qcom,pcie-sm8250";
   [....]
   bridge@0,0 {
        compatible = "pci17cb,010b", "linux,regulator-hotplug";
        [....]
        vcc-children-supply = <&qca6390>;
        /* known WiFi card */
   };
};

pce1: pci@1c08000 {
   compatible = "qcom,pcie-sm8250";
   [....]
   bridge@1,0 {
        compatible = "pci17cb,010b", "linux,regulator-hotplug";
        [....]
        vcc-children-supply = <&vdc_gpio13>;
        /* unpredictable devices on the mezzanine card */
   };
};

-- 
With best wishes
Dmitry

  parent reply	other threads:[~2021-02-03  4:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 17:52 [PATCH v2 0/5] Add support for Qualcomm QCA639x chips family Dmitry Baryshkov
2021-01-28 17:52 ` [PATCH v2 1/5] misc: qca639x: add support for QCA639x powerup sequence Dmitry Baryshkov
2021-01-28 17:52 ` [PATCH v2 2/5] arm64: qcom: dts: qrb5165-rb5: add qca6391 power device Dmitry Baryshkov
2021-01-30  3:47   ` Bjorn Andersson
2021-01-30  3:59     ` Manivannan Sadhasivam
2021-01-28 17:52 ` [PATCH v2 3/5] pcie-qcom: provide a way to power up qca6390 chip on RB5 platform Dmitry Baryshkov
     [not found]   ` <CAL_JsqLRn40h0K-Fze5m1LS2+raLp94LariMkUh7XtekTBT5+Q@mail.gmail.com>
2021-01-29  3:45     ` Dmitry Baryshkov
2021-01-29 21:50       ` Bjorn Helgaas
2021-01-29 22:19         ` Dmitry Baryshkov
2021-01-29 22:39           ` Bjorn Helgaas
2021-01-30  3:53           ` Bjorn Andersson
2021-01-30 16:14             ` Dmitry Baryshkov
2021-02-02 19:48               ` Bjorn Andersson
2021-02-02 21:37                 ` Rob Herring
2021-02-02 21:50                   ` Bjorn Andersson
2021-02-03  4:14                   ` Dmitry Baryshkov [this message]
2021-01-29 23:39       ` Rob Herring
2021-06-13 18:40   ` Konrad Dybcio
2021-01-28 17:52 ` [PATCH v2 4/5] arm64: dtb: qcom: qrb5165-rb5: add bridge@0,0 to power up qca6391 chip Dmitry Baryshkov
     [not found]   ` <CAL_Jsq+uim_0fDsCqSjgbz-xzUEu4GAf+KOgxSd1KdrFWjhd3Q@mail.gmail.com>
2021-01-29  3:48     ` Dmitry Baryshkov
2021-01-28 17:52 ` [PATCH v2 5/5] arm64: dts: qcom: Add Bluetooth support on RB5 Dmitry Baryshkov
     [not found]   ` <CAL_Jsq+nNRv3KceHthgktHR1oRMs+eKWC4O7n0k78izs1aTPfA@mail.gmail.com>
2021-01-29  3:49     ` Dmitry Baryshkov
2021-02-02  6:16     ` Manivannan Sadhasivam
2021-01-30  8:04 [PATCH v2 3/5] pcie-qcom: provide a way to power up qca6390 chip on RB5 platform Yassine Oudjana
2021-01-30 16:12 ` Dmitry Baryshkov

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=CAA8EJpq6A28RHSD7YVz_AAdWnnvtCEAh1XcPyUTu0Ufp67M1XA@mail.gmail.com \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=helgaas@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=svarbanov@mm-sol.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).