Skip to contentSkip to conversation

Add support for Qualcomm QCA639x chips family

PATCH Superseded Dmitry Baryshkov 3 participants 13 messages Dec 20, 2020 – Jan 14, 2021

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add support for Qualcomm QCA639x chips family

Qualcomm QCA639x is a family of WiFi + Bluetooth chips, with BT part being controlled through the UART and WiFi being present on PCIe bus. Both blocks share common power sources wich should be turned on before either of devices can be probed. Declare common 'qca639x' driver providing a power domain to be used by both BT and WiFi parts.

#1 lore raw

PATCH 1/4 dt-bindings: mfd: qcom,qca639x: add binding for QCA639x defvice

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.

---
 .../devicetree/bindings/mfd/qcom,qca639x.yaml | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +84 -0
new file mode 100644
index 000000000000..d43c75da136f
@@ -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 <[email protected]>
+  - Bjorn Andersson <[email protected]>
+
+description: |
+  This binding describes thes Qualcomm QCA6390 or QCA6391 power supplies and
+  enablement pins.
+
+properties:
+  compatible:
+    const: qcom,qca639x
+
+  '#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
+
+  vddio-supply:
+    description:
+      1.8V VIO input
+
+additionalProperties: false
+
+examples:
+  - |
+    qca639x: qca639x {
+      compatible = "qcom,qca639x";
+      #power-domain-cells = <0>;
+
+      vddaon-supply = <&vreg_s6a_0p95>;
+      vddpmu-supply = <&vreg_s2f_0p95>;
+      vddrfa1-supply = <&vreg_s2f_0p95>;
+      vddrfa2-supply = <&vreg_s8c_1p3>;
+      vddrfa3-supply = <&vreg_s5a_1p9>;
+      vddpcie1-supply = <&vreg_s8c_1p3>;
+      vddpcie2-supply = <&vreg_s5a_1p9>;
+      vddio-supply = <&vreg_s4a_1p8>;
+      pinctrl-names = "default", "active";
+      pinctrl-0 = <&wlan_default_state &bt_default_state>;
+      pinctrl-1 = <&wlan_active_state &bt_active_state>;
+    };
+...
Signature · 1 line
2.29.2
maintainer
#2 lore raw

Re: [PATCH 1/4] dt-bindings: mfd: qcom,qca639x: add binding for QCA639x defvice

Quoted 22 lines · Dmitry Baryshkov

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.

---
 .../devicetree/bindings/mfd/qcom,qca639x.yaml | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +5 -0
new file mode 100644
index 000000000000..d43c75da136f
@@ -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#"

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +10 -0
+
+title: Qualcomm QCA639x WiFi + Bluetoot SoC bindings
+
+maintainers:
+  - Andy Gross <[email protected]>
+  - Bjorn Andersson <[email protected]>
+
+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.

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 19

Quoted 4 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +4 -0
+
+properties:
+  compatible:
+    const: qcom,qca639x

List each device, we don't do wildcards in compatible strings.

Quoted 29 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +29 -0
+
+  '#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:

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 58

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +10 -0
+    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?

Supplies are refcounted, so I'd suggest just duplicating the supplies in both the BT and PCIe nodes.

Quoted 29 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +26 -0
+
+  vddio-supply:
+    description:
+      1.8V VIO input
+
+additionalProperties: false
+
+examples:
+  - |
+    qca639x: qca639x {
+      compatible = "qcom,qca639x";
+      #power-domain-cells = <0>;
+
+      vddaon-supply = <&vreg_s6a_0p95>;
+      vddpmu-supply = <&vreg_s2f_0p95>;
+      vddrfa1-supply = <&vreg_s2f_0p95>;
+      vddrfa2-supply = <&vreg_s8c_1p3>;
+      vddrfa3-supply = <&vreg_s5a_1p9>;
+      vddpcie1-supply = <&vreg_s8c_1p3>;
+      vddpcie2-supply = <&vreg_s5a_1p9>;
+      vddio-supply = <&vreg_s4a_1p8>;
+      pinctrl-names = "default", "active";
+      pinctrl-0 = <&wlan_default_state &bt_default_state>;
+      pinctrl-1 = <&wlan_active_state &bt_active_state>;
+    };
+...
Signature · 1 line
2.29.2
#3 lore raw

Re: [PATCH 1/4] dt-bindings: mfd: qcom,qca639x: add binding for QCA639x defvice

Hello,

Quoted 31 lines · Rob Herring
Quoted 29 lines · Dmitry Baryshkov

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.

---
 .../devicetree/bindings/mfd/qcom,qca639x.yaml | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +12 -0
new file mode 100644
index 000000000000..d43c75da136f
@@ -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 <[email protected]>
+  - Bjorn Andersson <[email protected]>
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 15

Quoted 3 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +3 -0
+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.

Quoted 7 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 19

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +4 -0
+
+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.

Quoted 34 lines
Quoted 34 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +33 -0
+
+  '#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:
Quoted 8 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 58

Quoted 6 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +6 -0
+    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

Quoted 3 lines

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).

Quoted 30 lines
Quoted 30 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +26 -1
+
+  vddio-supply:
+    description:
+      1.8V VIO input
+
+additionalProperties: false
+
+examples:
+  - |
+    qca639x: qca639x {
+      compatible = "qcom,qca639x";
+      #power-domain-cells = <0>;
+
+      vddaon-supply = <&vreg_s6a_0p95>;
+      vddpmu-supply = <&vreg_s2f_0p95>;
+      vddrfa1-supply = <&vreg_s2f_0p95>;
+      vddrfa2-supply = <&vreg_s8c_1p3>;
+      vddrfa3-supply = <&vreg_s5a_1p9>;
+      vddpcie1-supply = <&vreg_s8c_1p3>;
+      vddpcie2-supply = <&vreg_s5a_1p9>;
+      vddio-supply = <&vreg_s4a_1p8>;
+      pinctrl-names = "default", "active";
+      pinctrl-0 = <&wlan_default_state &bt_default_state>;
+      pinctrl-1 = <&wlan_active_state &bt_active_state>;
+    };
+...
--

2.29.2

Signature · 2 lines
With best wishes
Dmitry
maintainer
#4 lore raw

Re: [PATCH 1/4] dt-bindings: mfd: qcom,qca639x: add binding for QCA639x defvice

Quoted 109 lines · Dmitry Baryshkov

Hello,

Quoted 31 lines · Rob Herring
Quoted 29 lines · Dmitry Baryshkov

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.

---
 .../devicetree/bindings/mfd/qcom,qca639x.yaml | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +12 -0
new file mode 100644
index 000000000000..d43c75da136f
@@ -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 <[email protected]>
+  - Bjorn Andersson <[email protected]>
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 15

Quoted 3 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +3 -0
+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.

Quoted 7 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 19

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +4 -0
+
+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.

Quoted 34 lines
Quoted 34 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +33 -0
+
+  '#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:
Quoted 8 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 58

Quoted 6 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +6 -0
+    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

Quoted 3 lines

Supplies are refcounted, so I'd suggest just duplicating the supplies in both the BT and PCIe nodes.

Quoted 6 lines

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.

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.

Rob

#5 lore raw

Re: [PATCH 1/4] dt-bindings: mfd: qcom,qca639x: add binding for QCA639x defvice

Hi Rob,

Quoted 119 lines · Rob Herring
Quoted 109 lines · Dmitry Baryshkov

Hello,

Quoted 31 lines · Rob Herring
Quoted 29 lines · Dmitry Baryshkov

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.

---
 .../devicetree/bindings/mfd/qcom,qca639x.yaml | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +12 -0
new file mode 100644
index 000000000000..d43c75da136f
@@ -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 <[email protected]>
+  - Bjorn Andersson <[email protected]>
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 15

Quoted 3 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +3 -0
+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.

Quoted 7 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 19

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +4 -0
+
+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.

Quoted 34 lines
Quoted 34 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +33 -0
+
+  '#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:
Quoted 8 lines

Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml line 58

Quoted 6 lines
Documentation/devicetree/bindings/mfd/qcom,qca639x.yaml new file +6 -0
+    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

Quoted 3 lines

Supplies are refcounted, so I'd suggest just duplicating the supplies in both the BT and PCIe nodes.

Quoted 6 lines

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).

Quoted 3 lines

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.

Quoted 10 lines

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.

Quoted 2 lines

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>;
          };
    };
};
Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

PATCH 2/4 mfd: qca639x: add support for QCA639x powerup sequence

In reply to Dmitry Baryshkov

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. So add mfd device driver handling power sequencing of QCA6390/1.

---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/qcom-qca639x.c | 168 +++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/mfd/qcom-qca639x.c
drivers/mfd/Kconfig +12 -0
index bdfce7b15621..2fd6b9770ad0 100644
@@ -1036,6 +1036,18 @@ config MFD_PM8XXX
 	  Say M here if you want to include support for PM8xxx chips as a
 	  module. This will build a module called "pm8xxx-core".
 
+config MFD_QCOM_QCA639X
+	tristate "Qualcomm QCA639x WiFi/Bluetooth module support"
+	depends on REGULATOR && PM_GENERIC_DOMAINS
+	help
+	  If you say yes to this option, support will be included for Qualcomm
+	  QCA639x family of WiFi and Bluetooth SoCs. Note, this driver supports
+	  only power control for this SoC, you still have to enable individual
+	  Bluetooth and WiFi drivers.
+
+	  Say M here if you want to include support for QCA639x chips as a
+	  module. This will build a module called "qcom-qca639x".
+
 config MFD_QCOM_RPM
 	tristate "Qualcomm Resource Power Manager (RPM)"
 	depends on ARCH_QCOM && OF
drivers/mfd/Makefile +1 -0
index 14fdb188af02..da5747508faf 100644
@@ -202,6 +202,7 @@ obj-$(CONFIG_MFD_SI476X_CORE)	+= si476x-core.o
 obj-$(CONFIG_MFD_CS5535)	+= cs5535-mfd.o
 obj-$(CONFIG_MFD_OMAP_USB_HOST)	+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8XXX) 	+= qcom-pm8xxx.o ssbi.o
+obj-$(CONFIG_MFD_QCOM_QCA639X)	+= qcom-qca639x.o
 obj-$(CONFIG_MFD_QCOM_RPM)	+= qcom_rpm.o
 obj-$(CONFIG_MFD_SPMI_PMIC)	+= qcom-spmi-pmic.o
 obj-$(CONFIG_TPS65911_COMPARATOR)	+= tps65911-comparator.o
drivers/mfd/qcom-qca639x.c new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
2.29.2
#7 lore raw

Re: [PATCH 2/4] mfd: qca639x: add support for QCA639x powerup sequence

Quoted 5 lines · Dmitry Baryshkov

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. So add mfd device driver handling power sequencing of QCA6390/1.

Quoted 7 lines
---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/qcom-qca639x.c | 168 +++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/mfd/qcom-qca639x.c

This is not an MFD, since it utilised neither the MFD API nor of_platform_populate() to register child devices.

Suggest you use drivers/power or similar to handle shared power sequencing requirements.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#8 lore raw

Re: [PATCH 2/4] mfd: qca639x: add support for QCA639x powerup sequence

Hello,

Quoted 16 lines · Lee Jones
Quoted 5 lines · Dmitry Baryshkov

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. So add mfd device driver handling power sequencing of QCA6390/1.

Quoted 7 lines
---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/qcom-qca639x.c | 168 +++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/mfd/qcom-qca639x.c
Quoted 2 lines

This is not an MFD, since it utilised neither the MFD API nor of_platform_populate() to register child devices.

It would use them if the WiFi part was not on a discoverable bus.

Quoted 2 lines

Suggest you use drivers/power or similar to handle shared power sequencing requirements.

What about drivers/soc/qcom? Or drivers/misc?

Signature · 2 lines
With best wishes
Dmitry
#9 lore raw

Re: [PATCH 2/4] mfd: qca639x: add support for QCA639x powerup sequence

Quoted 19 lines · Dmitry Baryshkov

Hello,

Quoted 16 lines · Lee Jones
Quoted 12 lines · Dmitry Baryshkov

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. So add mfd device driver handling power sequencing of QCA6390/1.

---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/qcom-qca639x.c | 168 +++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/mfd/qcom-qca639x.c
Quoted 4 lines
Quoted 2 lines

This is not an MFD, since it utilised neither the MFD API nor of_platform_populate() to register child devices.

It would use them if the WiFi part was not on a discoverable bus.

This is a can of worms that I do not wish to open right now.

However the TL;DR is:

MFD is currently only *meant* for non-discoverable platform devices.

Quoted 4 lines
Quoted 2 lines

Suggest you use drivers/power or similar to handle shared power sequencing requirements.

What about drivers/soc/qcom? Or drivers/misc?

These are 2 other subsystems, just like MFD, which are commonly used as dumping grounds for code which doesn't fit anywhere else. However, I implore you to please try to find a suitable subsystem for this to fit into first. If this driver only deals with power management, place it is a power related subsystem *before* considering drivers/soc or drivers/misc.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#10 lore raw

Re: [PATCH 2/4] mfd: qca639x: add support for QCA639x powerup sequence

In reply to Dmitry Baryshkov
Quoted 19 lines · Dmitry Baryshkov

Hello,

Quoted 16 lines · Lee Jones
Quoted 12 lines · Dmitry Baryshkov

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. So add mfd device driver handling power sequencing of QCA6390/1.

---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/qcom-qca639x.c | 168 +++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/mfd/qcom-qca639x.c
Quoted 4 lines
Quoted 2 lines

This is not an MFD, since it utilised neither the MFD API nor of_platform_populate() to register child devices.

It would use them if the WiFi part was not on a discoverable bus.

PCI nodes have been supported in DT for forever. If you have non-discoverable additions to a PCI device, then the PCI device should be in DT.

Rob

#11 lore raw

PATCH 3/4 arm64: dts: qcom: Add Bluetooth support on RB5

In reply to Dmitry Baryshkov

From: Manivannan Sadhasivam <[email protected]>

Add Bluetooth support on RB5 using the onboard QCA6391 WLAN+BT chipset.

[DB: added qca639x power domain]
---
 arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 97 ++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +97 -0
index 1be984d89f48..e6bab9960cea 100644
@@ -17,6 +17,7 @@ / {
 	compatible = "qcom,qrb5165-rb5", "qcom,sm8250";
 
 	aliases {
+		hsuart0 = &uart6;
 		serial0 = &uart12;
 		sdhc2 = &sdhc_2;
 	};
@@ -118,6 +119,23 @@ vreg_s4a_1p8: vreg-s4a-1p8 {
 		regulator-max-microvolt = <1800000>;
 		regulator-always-on;
 	};
+
+	qca639x: qca639x {
+		compatible = "qcom,qca639x";
+		#power-domain-cells = <0>;
+
+		vddaon-supply = <&vreg_s6a_0p95>;
+		vddpmu-supply = <&vreg_s2f_0p95>;
+		vddrfa1-supply = <&vreg_s2f_0p95>;
+		vddrfa2-supply = <&vreg_s8c_1p3>;
+		vddrfa3-supply = <&vreg_s5a_1p9>;
+		vddpcie1-supply = <&vreg_s8c_1p3>;
+		vddpcie2-supply = <&vreg_s5a_1p9>;
+		vddio-supply = <&vreg_s4a_1p8>;
+		pinctrl-names = "default", "active";
+		pinctrl-0 = <&wlan_default_state &bt_default_state>;
+		pinctrl-1 = <&wlan_active_state &bt_active_state>;
+	};
 };
 
 &apps_rsc {
@@ -131,6 +149,13 @@ pm8009-rpmh-regulators {
 		vdd-l5-l6-supply = <&vreg_bob>;
 		vdd-l7-supply = <&vreg_s4a_1p8>;
 
+		vreg_s2f_0p95: smps2 {
+			regulator-name = "vreg_s2f_0p95";
+			regulator-min-microvolt = <512000>;
+			regulator-max-microvolt = <1100000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
+		};
+
 		vreg_l1f_1p1: ldo1 {
 			regulator-name = "vreg_l1f_1p1";
 			regulator-min-microvolt = <1104000>;
@@ -513,6 +538,26 @@ &pm8150_rtc {
 	status = "okay";
 };
 
+&qup_uart6_default {
+	ctsrx {
+		pins = "gpio16", "gpio19";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	rts {
+		pins = "gpio17";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	tx {
+		pins = "gpio18";
+		drive-strength = <2>;
+		bias-pull-up;
+	};
+};
+
 &qupv3_id_0 {
 	status = "okay";
 };
@@ -738,6 +783,28 @@ &tlmm {
 		"HST_WLAN_UART_TX",
 		"HST_WLAN_UART_RX";
 
+	bt_default_state: bt-default-state {
+		bt-en {
+			pins = "gpio21";
+			function = "gpio";
+
+			drive-strength = <16>;
+			output-low;
+			bias-pull-up;
+		};
+	};
+
+	bt_active_state: bt-active-state {
+		bt-en {
+			pins = "gpio21";
+			function = "gpio";
+
+			drive-strength = <16>;
+			output-high;
+			bias-pull-up;
+		};
+	};
+
 	pcie0_default_state: pcie0-default {
 		clkreq {
 			pins = "gpio80";
@@ -838,6 +905,36 @@ sdc2_card_det_n: sd-card-det-n {
 		function = "gpio";
 		bias-pull-up;
 	};
+
+	wlan_default_state: wlan-default-state {
+		wlan-en {
+			pins = "gpio20";
+			function = "gpio";
+
+			drive-strength = <16>;
+			output-low;
+			bias-pull-up;
+		};
+	};
+
+	wlan_active_state: wlan-active-state {
+		wlan-en {
+			pins = "gpio20";
+			function = "gpio";
+
+			drive-strength = <16>;
+			output-high;
+			bias-pull-up;
+		};
+	};
+};
+
+&uart6 {
+	status = "okay";
+	bluetooth {
+		compatible = "qcom,qca6390-bt";
+		power-domains = <&qca639x>;
+	};
 };
 
 &uart12 {
Signature · 1 line
2.29.2
#12 lore raw

PATCH 4/4 arm64: dtb: qcom: qrb5165-rb5: add power domain to pcie0 phy

In reply to Dmitry Baryshkov

If QCA6391 chip (connected to PCIe0) is not powered at the PCIe probe time, PCIe0 bus probe will timeout and the device will not be detected. To ease device power up support, use qca639x as pcie0 phy power-domain. This allows us to make sure that QCA6391 chip is powered on before PCIe0 probe happens.

---
 arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +3 -0
index e6bab9960cea..9aa7793cd7c0 100644
@@ -457,6 +457,9 @@ &pcie0_phy {
 	status = "okay";
 	vdda-phy-supply = <&vreg_l5a_0p88>;
 	vdda-pll-supply = <&vreg_l9a_1p2>;
+
+	/* Power on QCA639x chip, otherwise PCIe bus timeouts */
+	power-domains = <&qca639x>;
 };
 
 &pcie1 {
Signature · 1 line
2.29.2