Hi Rob, On Thu, 14 Jan 2021 at 17:33, Rob Herring <robh@xxxxxxxxxx> wrote: > > On Sat, Jan 2, 2021 at 9:41 PM Dmitry Baryshkov > <dmitry.baryshkov@xxxxxxxxxx> wrote: > > > > Hello, > > > > On Fri, 1 Jan 2021 at 01:50, Rob Herring <robh@xxxxxxxxxx> wrote: > > > > > > On Sun, Dec 20, 2020 at 07:58:42PM +0300, Dmitry Baryshkov wrote: > > > > Qualcomm QCA639x is a family of WiFi + Bluetooth SoCs, with BT part > > > > being controlled through the UART and WiFi being present on PCIe bus. > > > > Both blocks share common power sources. Add binding to describe power > > > > sequencing required to power up this device. > > > > > > > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > > > > --- > > > > .../devicetree/bindings/mfd/qcom,qca639x.yaml | 84 +++++++++++++++++++ > > > > 1 file changed, 84 insertions(+) > > > > create mode 100644 Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml > > > > > > > > diff --git a/Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml b/Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml > > > > new file mode 100644 > > > > index 000000000000..d43c75da136f > > > > --- /dev/null > > > > +++ b/Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml > > > > @@ -0,0 +1,84 @@ > > > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > > > +%YAML 1.2 > > > > +--- > > > > +$id: "http://devicetree.org/schemas/mfd/qcom,qca639x.yaml#" > > > > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > > > > + > > > > +title: Qualcomm QCA639x WiFi + Bluetoot SoC bindings > > > > + > > > > +maintainers: > > > > + - Andy Gross <agross@xxxxxxxxxx> > > > > + - Bjorn Andersson <bjorn.andersson@xxxxxxxxxx> > > > > + > > > > +description: | > > > > + This binding describes thes Qualcomm QCA6390 or QCA6391 power supplies and > > > > + enablement pins. > > > > > > Humm, this should really be for the whole device. For BT/WiFi chips > > > we've gotten away with 2 nodes for each interface. If that doesn't work > > > here, then I think this needs to be 1 node for all, not 3 as it seems > > > you are doing. > > > > 2 nodes: one for common power sequencer and one for bluetooth part. > > WiFi part doesn't need a separate node, but see below. > > > > > > > > > + > > > > +properties: > > > > + compatible: > > > > + const: qcom,qca639x > > > > > > List each device, we don't do wildcards in compatible strings. > > > > Ack. I will change this to qca6390, as 6391 should be fully compatible > > from the power sequence point of view. > > > > > > > > > + > > > > + '#power-domain-cells': > > > > + const: 0 > > > > + > > > > + pinctrl-0: true > > > > + pinctrl-1: true > > > > + > > > > + pinctrl-names: > > > > + items: > > > > + - const: default > > > > + - const: active > > > > + > > > > + vddaon-supply: > > > > + description: > > > > + 0.95V always-on LDO power input > > > > + > > > > + vddpmu-supply: > > > > + description: > > > > + 0.95V LDO power input to PMU > > > > + > > > > + vddrfa1-supply: > > > > + description: > > > > + 0.95V LDO power input to RFA > > > > + > > > > + vddrfa2-supply: > > > > + description: > > > > + 1.25V LDO power input to RFA > > > > + > > > > + vddrfa3-supply: > > > > + description: > > > > + 2V LDO power input to RFA > > > > + > > > > + vddpcie1-supply: > > > > + description: > > > > + 1.25V LDO power input to PCIe part > > > > + > > > > + vddpcie2-supply: > > > > + description: > > > > + 2V LDO power input to PCIe part > > > > > > Do the PCIe supplies have to be on if only the BT part is used? > > > > Good question. The documentation just tells us to power up all rails. > > There are further internal voltage regulators taking care of current > > qca639x mode > > > > > > > > Supplies are refcounted, so I'd suggest just duplicating the supplies in > > > both the BT and PCIe nodes. > > > > While for BT it would be easy, for PCIe it is not that easy. We have > > to make sure that the chip is powered up before the respective PCIe > > bus is probed (basically before the PCIe controller driver is probed). > > I ended up putting a reference to the PCIe PHY device node, making > > sure that qca6391 is powered up before the PCIe PHY driver is probed. > > PCIe device node itself has its own power-domains entry (PCIE_0_GDSC). > > This is an abuse of the power-domains binding and a complete hack, so > no. The wifi part should be a child node on the PCI bus. That's the > only acceptable solution for DT. I see your point here. > > Obviously there's a probe chicken and egg problem for Linux, but for > DT it doesn't matter. You have 2 options. You can fix PCIe to force > probe devices with a DT node (and lots of folks would appreciate it > because you aren't the only one needing it). If there's a DT node, > then you know there is a device there. This is what MDIO bus does. Or > you can keep your misc driver, but it needs to go find the PCIe child > node itself. IOW, you have to create the platform device yourself in > the initcall rather than rely on the DT code to create one. > > Personally, I wouldn't accept the 2nd solution as I think it is still > a hack, but I won't object. To make things worse, if the device is not powered during the initial PCIe host probe, the powerup sequence turns into PCIe hotplug story. Even PCIehp driver is probed after initial link training. Would you agree to one of the following variants: 1) Add extra power-domain to pcie host: pcie0: pci@1c00000 { compatible = "qcom,pcie-sm8250", "snps,dw-pcie"; [....] power-domains = <&gcc PCIE_0_GDSC>, <&qca639x>; power-domain-names = "core", "child"; }; 2) Add power domain to PCIe bridge device (and handle that from the host code): pcie0: pci@1c00000 { compatible = "qcom,pcie-sm8250", "snps,dw-pcie"; [....] power-domains = <&gcc PCIE_0_GDSC>; bridge@0,0 { compatible = "pci17cb,010b"; [.....] power-domains = <qca639x>; }; }; Does any of those variants seem suitable for you? Or you'd really insist on the following binding: 3) pcie0: pci@1c00000 { compatible = "qcom,pcie-sm8250", "snps,dw-pcie"; [....] power-domains = <&gcc PCIE_0_GDSC>; bridge@0,0 { compatible = "pci17cb,010b"; [.....] wifi@1,0 { compatible = "pci17cb,1101"; power-domains = <qca639x>; }; }; }; -- With best wishes Dmitry