PCI: Add initial support for handling PCIe M.2 connectors in devicetree
Subsystems (6)
v2 cover PCI: Add initial support for handling PCIe M.2 connectors in devicetree
Hi,
This series is an initial attempt to support the PCIe M.2 connectors in the kernel and devicetree binding. The PCIe M.2 connectors as defined in the PCI Express M.2 Specification are widely used in Notebooks/Tablet form factors (even in PCs). On the ACPI platforms, power to these connectors are mostly handled by the firmware/BIOS and the kernel never bothered to directly power manage them as like other PCIe connectors. But on the devicetree platforms, the kernel needs to power manage these connectors with the help of the devicetree description. But so far, there is no proper representation of the M.2 connectors in devicetree binding. This forced the developers to fake the M.2 connectors as PMU nodes [1] and fixed regulators in devicetree.
So to properly support the M.2 connectors in devicetree platforms, this series introduces the devicetree binding for Mechanical Key M connector as an example and also the corresponding pwrseq driver and PCI changes in kernel to driver the connector.
The Mechanical Key M connector is used to connect SSDs to the host machine over PCIe/SATA interfaces. Due to the hardware constraints, this series only adds support for driving the PCIe interface of the connector in the kernel.
Also, the optional interfaces supported by the Key M connectors are not supported in the driver and left for the future enhancements.
Future work
===========
I'm planning to submit the follow-up series to add support for the Mechanical Key A connector for connecting the WiFI/BT cards, once some initial review happens on this series.
Testing
=======
This series, together with the devicetree changes [2] [3] were tested on the Qualcomm X1e based Lenovo Thinkpad T14s Laptop which has the NVMe SSD connected over PCIe.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts?h=v6.18-rc4&id=d09ab685a8f51ba412d37305ea62628a01cbea57
[2] https://github.com/Mani-Sadhasivam/linux/commit/8f1d17c01a0d607a36e19c6d9f7fc877226ba315
[3] https://github.com/Mani-Sadhasivam/linux/commit/0b1f14a18db2a04046ad6af40e94984166c78fbc
---
Changes in v2:
- Incorporated comments from Bartosz and Frank for pwrseq and dt-binding patches, especially adding the pwrseq match() code.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Manivannan Sadhasivam (4):
dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector PCI/pwrctrl: Add support for handling PCIe M.2 connectors PCI/pwrctrl: Create pwrctrl device if the graph port is found
power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
.../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++ MAINTAINERS | 7 + drivers/pci/probe.c | 3 +- drivers/pci/pwrctrl/Kconfig | 1 + drivers/pci/pwrctrl/slot.c | 35 ++++- drivers/power/sequencing/Kconfig | 8 + drivers/power/sequencing/Makefile | 1 + drivers/power/sequencing/pwrseq-pcie-m2.c | 163 +++++++++++++++++++++ 8 files changed, 334 insertions(+), 6 deletions(-)
---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251103-pci-m2-7633631b6faa
Best regards,
Signature · 1 line
Manivannan Sadhasivam <[email protected]>
PATCH v2 1/4 dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +122 -0
@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB. + +properties: + compatible: + const: pcie-m2-m-connector + + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interface + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: USB interface + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: SMB interface + + required: + - port@0 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + pedet-gpios: + description: GPIO controlled connection to PEDET signal. This signal is used + by the host systems to determine the communication protocol that the M.2 + card uses; SATA signaling (low) or PCIe signaling (high). Refer, PCI + Express M.2 Specification r4.0, sec 3.3.4.2 for more details. + maxItems: 1 + + led1-gpios: + description: GPIO controlled connection to LED_1# signal. This signal is + used by the M.2 card to indicate the card status via the system mounted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + viocfg-gpios: + description: GPIO controlled connection to IO voltage configuration + (VIO_CFG) signal. This signal is used by the M.2 card to indicate to the + host system that the card supports an independent IO voltage domain for + the sideband signals. Refer, PCI Express M.2 Specification r4.0, sec + 3.1.15.1 for more details. + maxItems: 1 + + pwrdis-gpios: + description: GPIO controlled connection to Power Disable (PWRDIS) signal. + This signal is used by the host system to disable power on the M.2 card. + Refer, PCI Express M.2 Specification r4.0, sec 3.3.5.2 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO controlled connection to Power Loss Notification (PLN#) + signal. This signal is use to notify the M.2 card by the host system that + the power loss event is expected to occur. Refer, PCI Express M.2 + Specification r4.0, sec 3.2.17.1 for more details. + maxItems: 1 + + plas3-gpios: + description: GPIO controlled connection to Power Loss Acknowledge (PLA_S3#) + signal. This signal is used by the M.2 card to notify the host system, the + status of the M.2 card's preparation for power loss. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key M connector for SSDs with PCIe interface + - | + connector { + compatible = "pcie-m2-m-connector"; + vpcie3v3-supply = <&vreg_nvme>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + }; + };
Signature · 1 line
2.48.1
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 36 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +10
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]>
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +10
-0+ +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB. + +properties: + compatible: + const: pcie-m2-m-connector
Is a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
Quoted 7 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +7
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. +
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +10
-0+ ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interface
Should it be defined as having two endpoints: one for PCIe, one for SATA?
Quoted 89 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +85
-0+ + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: USB interface + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: SMB interface + + required: + - port@0 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + pedet-gpios: + description: GPIO controlled connection to PEDET signal. This signal is used + by the host systems to determine the communication protocol that the M.2 + card uses; SATA signaling (low) or PCIe signaling (high). Refer, PCI + Express M.2 Specification r4.0, sec 3.3.4.2 for more details. + maxItems: 1 + + led1-gpios: + description: GPIO controlled connection to LED_1# signal. This signal is + used by the M.2 card to indicate the card status via the system mounted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + viocfg-gpios: + description: GPIO controlled connection to IO voltage configuration + (VIO_CFG) signal. This signal is used by the M.2 card to indicate to the + host system that the card supports an independent IO voltage domain for + the sideband signals. Refer, PCI Express M.2 Specification r4.0, sec + 3.1.15.1 for more details. + maxItems: 1 + + pwrdis-gpios: + description: GPIO controlled connection to Power Disable (PWRDIS) signal. + This signal is used by the host system to disable power on the M.2 card. + Refer, PCI Express M.2 Specification r4.0, sec 3.3.5.2 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO controlled connection to Power Loss Notification (PLN#) + signal. This signal is use to notify the M.2 card by the host system that + the power loss event is expected to occur. Refer, PCI Express M.2 + Specification r4.0, sec 3.2.17.1 for more details. + maxItems: 1 + + plas3-gpios: + description: GPIO controlled connection to Power Loss Acknowledge (PLA_S3#) + signal. This signal is used by the M.2 card to notify the host system, the + status of the M.2 card's preparation for power loss. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key M connector for SSDs with PCIe interface + - | + connector { + compatible = "pcie-m2-m-connector"; + vpcie3v3-supply = <&vreg_nvme>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + }; + };Signature · 2 lines
-- 2.48.1
Signature · 2 lines
With best wishes Dmitry
Manivannan Sadhasivam
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.
Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +4
-0+ +properties: + compatible: + const: pcie-m2-m-connectorIs a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
I can't comment on it as I've not seen such usecases as of now. But I do think that this generic compatible should satisfy most of the design requirements. If necessity arises, a custom compatible could be introduced with this generic one as a fallback.
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +12
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below.
Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interfaceShould it be defined as having two endpoints: one for PCIe, one for SATA?
I'm not sure. From the dtschema of the connector node:
"If a single port is connected to more than one remote device, an 'endpoint' child node must be provided for each link"
Here, a single port is atmost connected to only one endpoint and that endpoint could PCIe/SATA. So IMO, defining two endpoint nodes doesn't fit here.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 54 lines · Manivannan Sadhasivam
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +4
-0+ +properties: + compatible: + const: pcie-m2-m-connectorIs a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
Quoted 4 lines
I can't comment on it as I've not seen such usecases as of now. But I do think that this generic compatible should satisfy most of the design requirements. If necessity arises, a custom compatible could be introduced with this generic one as a fallback.
Ack
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +12
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interfaceShould it be defined as having two endpoints: one for PCIe, one for SATA?
Quoted 7 lines
I'm not sure. From the dtschema of the connector node:
"If a single port is connected to more than one remote device, an 'endpoint' child node must be provided for each link"
Here, a single port is atmost connected to only one endpoint and that endpoint could PCIe/SATA. So IMO, defining two endpoint nodes doesn't fit here.
I think this needs to be better defined. E.g. there should be either one endpoint going to the shared SATA / PCIe MUX, which should then be controlled somehow, in a platform-specific way (how?) or there should be two endpoints defined, e.g. @0 for SATA and @1 for PCIe (should we prevent powering up M.2 if PEDET points out the unsupported function?). (Note: these questions might be the definitive point for the bare m2-m-connector vs gpio-m2-m-connector: the former one defines just the M.2 signals, letting e.g. UEFI or PCIe controller to react to them, the latter one defines how to control MUXes, the behaviour wrt PEDET, etc., performing all those actions in OS driver).
Likewise, for USB you specify just the port, but is it just USB 2.0 or USB 3.0 port? In the latter case we should have two endpoints defined, one for DP/DM and another one for SS singnals.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 93 lines · Dmitry Baryshkov
Quoted 54 lines · Manivannan Sadhasivam
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +4
-0+ +properties: + compatible: + const: pcie-m2-m-connectorIs a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
Quoted 4 lines
I can't comment on it as I've not seen such usecases as of now. But I do think that this generic compatible should satisfy most of the design requirements. If necessity arises, a custom compatible could be introduced with this generic one as a fallback.
Ack
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +12
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interfaceShould it be defined as having two endpoints: one for PCIe, one for SATA?
Quoted 7 lines
I'm not sure. From the dtschema of the connector node:
"If a single port is connected to more than one remote device, an 'endpoint' child node must be provided for each link"
Here, a single port is atmost connected to only one endpoint and that endpoint could PCIe/SATA. So IMO, defining two endpoint nodes doesn't fit here.
Quoted 11 lines
I think this needs to be better defined. E.g. there should be either one endpoint going to the shared SATA / PCIe MUX, which should then be controlled somehow, in a platform-specific way (how?) or there should be two endpoints defined, e.g. @0 for SATA and @1 for PCIe (should we prevent powering up M.2 if PEDET points out the unsupported function?). (Note: these questions might be the definitive point for the bare m2-m-connector vs gpio-m2-m-connector: the former one defines just the M.2 signals, letting e.g. UEFI or PCIe controller to react to them, the latter one defines how to control MUXes, the behaviour wrt PEDET, etc., performing all those actions in OS driver).
In the case of an external GPIO controlled MUX for PCIe/SATA interface, I would assume that the MUX will be controlled by the PEDET itself. PEDET will be driven low by the card if it uses SATA, pulled high (NC) if it uses PCIe. Then that signal will help the MUX to route the proper interface to the connector.
Even in that case, there should be a single endpoint coming from the MUX to the connector.
Quoted 4 lines
Likewise, for USB you specify just the port, but is it just USB 2.0 or USB 3.0 port? In the latter case we should have two endpoints defined, one for DP/DM and another one for SS singnals.
The M.2 spec limits the USB interface to 2.0 for Key M. I missed mentioning it.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 106 lines · Manivannan Sadhasivam
Quoted 93 lines · Dmitry Baryshkov
Quoted 54 lines · Manivannan Sadhasivam
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +4
-0+ +properties: + compatible: + const: pcie-m2-m-connectorIs a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
Quoted 4 lines
I can't comment on it as I've not seen such usecases as of now. But I do think that this generic compatible should satisfy most of the design requirements. If necessity arises, a custom compatible could be introduced with this generic one as a fallback.
Ack
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +12
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interfaceShould it be defined as having two endpoints: one for PCIe, one for SATA?
Quoted 7 lines
I'm not sure. From the dtschema of the connector node:
"If a single port is connected to more than one remote device, an 'endpoint' child node must be provided for each link"
Here, a single port is atmost connected to only one endpoint and that endpoint could PCIe/SATA. So IMO, defining two endpoint nodes doesn't fit here.
Quoted 11 lines
I think this needs to be better defined. E.g. there should be either one endpoint going to the shared SATA / PCIe MUX, which should then be controlled somehow, in a platform-specific way (how?) or there should be two endpoints defined, e.g. @0 for SATA and @1 for PCIe (should we prevent powering up M.2 if PEDET points out the unsupported function?). (Note: these questions might be the definitive point for the bare m2-m-connector vs gpio-m2-m-connector: the former one defines just the M.2 signals, letting e.g. UEFI or PCIe controller to react to them, the latter one defines how to control MUXes, the behaviour wrt PEDET, etc., performing all those actions in OS driver).
Quoted 7 lines
In the case of an external GPIO controlled MUX for PCIe/SATA interface, I would assume that the MUX will be controlled by the PEDET itself. PEDET will be driven low by the card if it uses SATA, pulled high (NC) if it uses PCIe. Then that signal will help the MUX to route the proper interface to the connector.
Even in that case, there should be a single endpoint coming from the MUX to the connector.
How would you model this in the actual DT? We don't have separate PCIe/SATA muxes in DT, do we?
Quoted 7 lines
Quoted 5 lines
Likewise, for USB you specify just the port, but is it just USB 2.0 or USB 3.0 port? In the latter case we should have two endpoints defined, one for DP/DM and another one for SS singnals.
The M.2 spec limits the USB interface to 2.0 for Key M. I missed mentioning it.
Signature · 2 lines
With best wishes Dmitry
Manivannan Sadhasivam
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 112 lines · Dmitry Baryshkov
Quoted 111 lines · Manivannan Sadhasivam
Quoted 93 lines · Dmitry Baryshkov
Quoted 54 lines · Manivannan Sadhasivam
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +4
-0+ +properties: + compatible: + const: pcie-m2-m-connectorIs a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
Quoted 4 lines
I can't comment on it as I've not seen such usecases as of now. But I do think that this generic compatible should satisfy most of the design requirements. If necessity arises, a custom compatible could be introduced with this generic one as a fallback.
Ack
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +12
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interfaceShould it be defined as having two endpoints: one for PCIe, one for SATA?
Quoted 7 lines
I'm not sure. From the dtschema of the connector node:
"If a single port is connected to more than one remote device, an 'endpoint' child node must be provided for each link"
Here, a single port is atmost connected to only one endpoint and that endpoint could PCIe/SATA. So IMO, defining two endpoint nodes doesn't fit here.
Quoted 11 lines
I think this needs to be better defined. E.g. there should be either one endpoint going to the shared SATA / PCIe MUX, which should then be controlled somehow, in a platform-specific way (how?) or there should be two endpoints defined, e.g. @0 for SATA and @1 for PCIe (should we prevent powering up M.2 if PEDET points out the unsupported function?). (Note: these questions might be the definitive point for the bare m2-m-connector vs gpio-m2-m-connector: the former one defines just the M.2 signals, letting e.g. UEFI or PCIe controller to react to them, the latter one defines how to control MUXes, the behaviour wrt PEDET, etc., performing all those actions in OS driver).
In the case of an external GPIO controlled MUX for PCIe/SATA interface, I would assume that the MUX will be controlled by the PEDET itself. PEDET will be driven low by the card if it uses SATA, pulled high (NC) if it uses PCIe. Then that signal will help the MUX to route the proper interface to the connector.
Quoted 6 lines
Quoted 2 lines
Even in that case, there should be a single endpoint coming from the MUX to the connector.
How would you model this in the actual DT? We don't have separate PCIe/SATA muxes in DT, do we?
I think I got it wrong here. Even in the case of MUX, the actual endpoint link should exist between PCIe and SATA nodes to the connector node. So yes, having 2 endpoint nodes makes sense.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Rob Herring
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
In reply to Dmitry BaryshkovQuoted 112 lines · Dmitry Baryshkov
Quoted 111 lines · Manivannan Sadhasivam
Quoted 93 lines · Dmitry Baryshkov
Quoted 54 lines · Manivannan Sadhasivam
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +4
-0+ +properties: + compatible: + const: pcie-m2-m-connectorIs a generic compatible enough here? Compare this to the USB connectors, which, in case of an independent USB-B connector controlled/ing GPIOs, gets additional gpio-usb-b-connector?
Quoted 4 lines
I can't comment on it as I've not seen such usecases as of now. But I do think that this generic compatible should satisfy most of the design requirements. If necessity arises, a custom compatible could be introduced with this generic one as a fallback.
Ack
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +12
-0+ + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below.Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 37
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interfaceShould it be defined as having two endpoints: one for PCIe, one for SATA?
Quoted 7 lines
I'm not sure. From the dtschema of the connector node:
"If a single port is connected to more than one remote device, an 'endpoint' child node must be provided for each link"
Here, a single port is atmost connected to only one endpoint and that endpoint could PCIe/SATA. So IMO, defining two endpoint nodes doesn't fit here.
Quoted 11 lines
I think this needs to be better defined. E.g. there should be either one endpoint going to the shared SATA / PCIe MUX, which should then be controlled somehow, in a platform-specific way (how?) or there should be two endpoints defined, e.g. @0 for SATA and @1 for PCIe (should we prevent powering up M.2 if PEDET points out the unsupported function?). (Note: these questions might be the definitive point for the bare m2-m-connector vs gpio-m2-m-connector: the former one defines just the M.2 signals, letting e.g. UEFI or PCIe controller to react to them, the latter one defines how to control MUXes, the behaviour wrt PEDET, etc., performing all those actions in OS driver).
In the case of an external GPIO controlled MUX for PCIe/SATA interface, I would assume that the MUX will be controlled by the PEDET itself. PEDET will be driven low by the card if it uses SATA, pulled high (NC) if it uses PCIe. Then that signal will help the MUX to route the proper interface to the connector.
Quoted 5 lines
Quoted 2 lines
Even in that case, there should be a single endpoint coming from the MUX to the connector.
How would you model this in the actual DT? We don't have separate PCIe/SATA muxes in DT, do we?
Do we have to describe it? On an x86 system, does something have to describe what's connected? Wouldn't you try a PCIe link and then a SATA link if the PCIe link doesn't come up?
Rob
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
In reply to Manivannan SadhasivamHi,
Quoted 12 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
Quoted 7 lines
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)
I would expect something similar to usb-connector.yaml, i.e. m2-connector.yaml, which then defines
compatible:
enum:
- m2-a-connector
- m2-b-connector
- m2-e-connector
- m2-m-connector
(also not sure if we need the PCIe prefix, it just seems to make the name longer)
Greetings,
-- Sebastian
Manivannan Sadhasivam
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 26 lines · Sebastian Reichel
Hi,
Quoted 12 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
Quoted 7 lines
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)I would expect something similar to
usb-connector.yaml, i.e.m2-connector.yaml, which then defines
Quoted 6 lines
compatible:
enum:
- m2-a-connector
- m2-b-connector
- m2-e-connector
- m2-m-connector
The interfaces of each Key greatly varies as per the spec. So I was planning to use a separate schema for each one of them to avoid clutter.
Quoted 4 lines
(also not sure if we need the PCIe prefix, it just seems to make the name longer)
The M.2 card is always connected to the PCIe connector even if the interface could use something else other than PCIe. So having the 'pcie' prefix seems logical to me.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
In reply to Manivannan SadhasivamQuoted 42 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +16
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB.
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +10
-0+ +properties: + compatible: + const: pcie-m2-m-connector + + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply.
FYI I just added vpcie1v8-supply to the core DT schema [1]. vpcie1v8 instead of vio1v8 was requested by Rob.
Quoted 100 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +96
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interface + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: USB interface + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: SMB interface + + required: + - port@0 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + pedet-gpios: + description: GPIO controlled connection to PEDET signal. This signal is used + by the host systems to determine the communication protocol that the M.2 + card uses; SATA signaling (low) or PCIe signaling (high). Refer, PCI + Express M.2 Specification r4.0, sec 3.3.4.2 for more details. + maxItems: 1 + + led1-gpios: + description: GPIO controlled connection to LED_1# signal. This signal is + used by the M.2 card to indicate the card status via the system mounted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + viocfg-gpios: + description: GPIO controlled connection to IO voltage configuration + (VIO_CFG) signal. This signal is used by the M.2 card to indicate to the + host system that the card supports an independent IO voltage domain for + the sideband signals. Refer, PCI Express M.2 Specification r4.0, sec + 3.1.15.1 for more details. + maxItems: 1 + + pwrdis-gpios: + description: GPIO controlled connection to Power Disable (PWRDIS) signal. + This signal is used by the host system to disable power on the M.2 card. + Refer, PCI Express M.2 Specification r4.0, sec 3.3.5.2 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO controlled connection to Power Loss Notification (PLN#) + signal. This signal is use to notify the M.2 card by the host system that + the power loss event is expected to occur. Refer, PCI Express M.2 + Specification r4.0, sec 3.2.17.1 for more details. + maxItems: 1 + + plas3-gpios: + description: GPIO controlled connection to Power Loss Acknowledge (PLA_S3#) + signal. This signal is used by the M.2 card to notify the host system, the + status of the M.2 card's preparation for power loss. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key M connector for SSDs with PCIe interface + - | + connector { + compatible = "pcie-m2-m-connector"; + vpcie3v3-supply = <&vreg_nvme>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + }; + };Signature · 2 lines
-- 2.48.1
Manivannan Sadhasivam
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
Quoted 48 lines · Chen-Yu Tsai
Quoted 47 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +21
-0@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB. + +properties: + compatible: + const: pcie-m2-m-connector +
Quoted 9 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml line 26
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +5
-0+ vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply.FYI I just added vpcie1v8-supply to the core DT schema [1]. vpcie1v8 instead of vio1v8 was requested by Rob.
Ok, thanks for doing it. I will change the property name in v3 and in the follow-up series.
- Mani
Quoted 102 lines
[1] https://github.com/devicetree-org/dt-schema/pull/176
Quoted 100 lines
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +96
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interface + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: USB interface + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: SMB interface + + required: + - port@0 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + pedet-gpios: + description: GPIO controlled connection to PEDET signal. This signal is used + by the host systems to determine the communication protocol that the M.2 + card uses; SATA signaling (low) or PCIe signaling (high). Refer, PCI + Express M.2 Specification r4.0, sec 3.3.4.2 for more details. + maxItems: 1 + + led1-gpios: + description: GPIO controlled connection to LED_1# signal. This signal is + used by the M.2 card to indicate the card status via the system mounted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + viocfg-gpios: + description: GPIO controlled connection to IO voltage configuration + (VIO_CFG) signal. This signal is used by the M.2 card to indicate to the + host system that the card supports an independent IO voltage domain for + the sideband signals. Refer, PCI Express M.2 Specification r4.0, sec + 3.1.15.1 for more details. + maxItems: 1 + + pwrdis-gpios: + description: GPIO controlled connection to Power Disable (PWRDIS) signal. + This signal is used by the host system to disable power on the M.2 card. + Refer, PCI Express M.2 Specification r4.0, sec 3.3.5.2 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO controlled connection to Power Loss Notification (PLN#) + signal. This signal is use to notify the M.2 card by the host system that + the power loss event is expected to occur. Refer, PCI Express M.2 + Specification r4.0, sec 3.2.17.1 for more details. + maxItems: 1 + + plas3-gpios: + description: GPIO controlled connection to Power Loss Acknowledge (PLA_S3#) + signal. This signal is used by the M.2 card to notify the host system, the + status of the M.2 card's preparation for power loss. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key M connector for SSDs with PCIe interface + - | + connector { + compatible = "pcie-m2-m-connector"; + vpcie3v3-supply = <&vreg_nvme>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + }; + };Signature · 2 lines
-- 2.48.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
In reply to Manivannan SadhasivamQuoted 12 lines · Manivannan Sadhasivam
Add the devicetree binding for PCIe M.2 Mechanical Key M connector defined in the PCI Express M.2 Specification, r4.0, sec 5.3. This connector provides interfaces like PCIe and SATA to attach the Solid State Drives (SSDs) to the host machine along with additional interfaces like USB, and SMB for debugging and supplementary features. At any point of time, the connector can only support either PCIe or SATA as the primary host interface.
The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling.
Quoted 5 lines
The connector also supplies optional signals in the form of GPIOs for fine grained power management.
Signed-off-by Manivannan Sadhasivam <[email protected]>---
Quoted 135 lines
.../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml new file +122
-1@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-m-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key M Connector + +maintainers: + - Manivannan Sadhasivam <[email protected]> + +description: + A PCIe M.2 M connector node represents a physical PCIe M.2 Mechanical Key M + connector. The Mechanical Key M connectors are used to connect SSDs to the + host system over PCIe/SATA interfaces. These connectors also offer optional + interfaces like USB, SMB. + +properties: + compatible: + const: pcie-m2-m-connector + + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vio1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, every + interface has an assigned OF graph port number as described below. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe/SATA interface + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: USB interface + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: SMB interface + + required: + - port@0 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + pedet-gpios: + description: GPIO controlled connection to PEDET signal. This signal is used + by the host systems to determine the communication protocol that the M.2 + card uses; SATA signaling (low) or PCIe signaling (high). Refer, PCI + Express M.2 Specification r4.0, sec 3.3.4.2 for more details. + maxItems: 1 + + led1-gpios: + description: GPIO controlled connection to LED_1# signal. This signal is + used by the M.2 card to indicate the card status via the system mounted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + viocfg-gpios: + description: GPIO controlled connection to IO voltage configuration + (VIO_CFG) signal. This signal is used by the M.2 card to indicate to the + host system that the card supports an independent IO voltage domain for + the sideband signals. Refer, PCI Express M.2 Specification r4.0, sec + 3.1.15.1 for more details. + maxItems: 1 + + pwrdis-gpios: + description: GPIO controlled connection to Power Disable (PWRDIS) signal. + This signal is used by the host system to disable power on the M.2 card. + Refer, PCI Express M.2 Specification r4.0, sec 3.3.5.2 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO controlled connection to Power Loss Notification (PLN#) + signal. This signal is use to notify the M.2 card by the host system that + the power loss event is expected to occur. Refer, PCI Express M.2 + Specification r4.0, sec 3.2.17.1 for more details. + maxItems: 1 + + plas3-gpios: + description: GPIO controlled connection to Power Loss Acknowledge (PLA_S3#) + signal. This signal is used by the M.2 card to notify the host system, the + status of the M.2 card's preparation for power loss. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key M connector for SSDs with PCIe interface + - | + connector { + compatible = "pcie-m2-m-connector"; + vpcie3v3-supply = <&vreg_nvme>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + }; + }; --2.48.1
PATCH v2 2/4 PCI/pwrctrl: Add support for handling PCIe M.2 connectors
In reply to Manivannan SadhasivamAdd support for handling the PCIe M.2 connectors as Power Sequencing devices. These connectors are exposed as the Power Sequencing devices as they often support multiple interfaces like PCIe/SATA, USB/UART to the host machine and each interfaces could be driven by different client drivers at the same time.
This driver handles the PCIe interface of these connectors. It first checks for the presence of the graph port in the Root Port node with the help of of_graph_is_present() API, if present, it acquires/poweres ON the corresponding pwrseq device.
Once the pwrseq device is powered ON, the driver will skip parsing the Root Port/Slot resources and registers with the pwrctrl framework.
--- drivers/pci/pwrctrl/Kconfig | 1 + drivers/pci/pwrctrl/slot.c | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-)
drivers/pci/pwrctrl/Kconfig +1 -0
@@ -13,6 +13,7 @@ config PCI_PWRCTRL_PWRSEQ config PCI_PWRCTRL_SLOT tristate "PCI Power Control driver for PCI slots" + select POWER_SEQUENCING select PCI_PWRCTRL help Say Y here to enable the PCI Power Control driver to control the power
drivers/pci/pwrctrl/slot.c +30 -5
@@ -8,8 +8,10 @@#include <linux/device.h> #include <linux/mod_devicetable.h> #include <linux/module.h> +#include <linux/of_graph.h> #include <linux/pci-pwrctrl.h> #include <linux/platform_device.h> +#include <linux/pwrseq/consumer.h> #include <linux/regulator/consumer.h> #include <linux/slab.h>
@@ -17,12 +19,18 @@ struct pci_pwrctrl_slot_data {struct pci_pwrctrl ctx;struct regulator_bulk_data *supplies;int num_supplies; +struct pwrseq_desc *pwrseq; };static void devm_pci_pwrctrl_slot_power_off (void *data) {struct pci_pwrctrl_slot_data *slot = data; +if (slot->pwrseq) { +pwrseq_power_off (slot->pwrseq); +return ; + } +regulator_bulk_disable (slot->num_supplies, slot->supplies);regulator_bulk_free (slot->num_supplies, slot->supplies); }
@@ -38,6 +46,20 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)if (!slot)return -ENOMEM ; +if (of_graph_is_present (dev_of_node (dev))) { + slot->pwrseq =devm_pwrseq_get (dev,"pcie" ); +if (IS_ERR (slot->pwrseq)) +return dev_err_probe (dev,PTR_ERR (slot->pwrseq), +"Failed to get the power sequencer\n" ); + + ret =pwrseq_power_on (slot->pwrseq); +if (ret) +return dev_err_probe (dev, ret, +"Failed to power-on the device\n" ); + + goto skip_resources; + } + ret =of_regulator_bulk_get_all (dev,dev_of_node (dev), &slot->supplies);if (ret <0 ) {
@@ -53,17 +75,20 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)return ret; } - ret =devm_add_action_or_reset (dev, devm_pci_pwrctrl_slot_power_off, - slot); -if (ret) -return ret; - clk =devm_clk_get_optional_enabled (dev,NULL );if (IS_ERR (clk)) { +regulator_bulk_disable (slot->num_supplies, slot->supplies); +regulator_bulk_free (slot->num_supplies, slot->supplies);return dev_err_probe (dev,PTR_ERR (clk),"Failed to enable slot clock\n" ); } +skip_resources: + ret =devm_add_action_or_reset (dev, devm_pci_pwrctrl_slot_power_off, + slot); +if (ret) +return ret; +pci_pwrctrl_init (&slot->ctx, dev); ret =devm_pci_pwrctrl_device_set_ready (dev, &slot->ctx);
Signature · 1 line
2.48.1
Re: [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors
Quoted 12 lines · Manivannan Sadhasivam
Add support for handling the PCIe M.2 connectors as Power Sequencing devices. These connectors are exposed as the Power Sequencing devices as they often support multiple interfaces like PCIe/SATA, USB/UART to the host machine and each interfaces could be driven by different client drivers at the same time.
This driver handles the PCIe interface of these connectors. It first checks for the presence of the graph port in the Root Port node with the help of
of_graph_is_present()API, if present, it acquires/poweres ON the corresponding pwrseq device.
Quoted 5 lines
Once the pwrseq device is powered ON, the driver will skip parsing the Root Port/Slot resources and registers with the pwrctrl framework.
Signed-off-by Manivannan Sadhasivam <[email protected]>---
PATCH v2 3/4 PCI/pwrctrl: Create pwrctrl device if the graph port is found
In reply to Manivannan SadhasivamThe devicetree node of the PCIe Root Port/Slot could have the graph port to link the PCIe M.2 connector node. Since the M.2 connectors are modelled as Power Sequencing devices, they need to be controlled by the pwrctrl driver as like the Root Port/Slot supplies.
Hence, create the pwrctrl device if the graph port is found in the node.
--- drivers/pci/probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/probe.c +2 -1
@@ -9,6 +9,7 @@#include <linux/init.h> #include <linux/pci.h> #include <linux/msi.h> +#include <linux/of_graph.h> #include <linux/of_pci.h> #include <linux/of_platform.h> #include <linux/platform_device.h>
@@ -2555,7 +2556,7 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, in* not. This is decided based on at least one of the power supplies * being defined in the devicetree node of the device. */ -if (!of_pci_supply_present (np)) { +if (!of_pci_supply_present (np) && !of_graph_is_present (np)) {pr_debug ("PCI/pwrctrl: Skipping OF node: %s\n" , np->name); goto err_put_of_node; }
Signature · 1 line
2.48.1
Re: [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found
Quoted 36 lines · Manivannan Sadhasivam
The devicetree node of the PCIe Root Port/Slot could have the graph port to link the PCIe M.2 connector node. Since the M.2 connectors are modelled as Power Sequencing devices, they need to be controlled by the pwrctrl driver as like the Root Port/Slot supplies.
Hence, create the pwrctrl device if the graph port is found in the node.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/probe.c +2
-2@@ -9,6 +9,7 @@#include <linux/init.h> #include <linux/pci.h> #include <linux/msi.h> +#include <linux/of_graph.h> #include <linux/of_pci.h> #include <linux/of_platform.h> #include <linux/platform_device.h> @@ -2555,7 +2556,7 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, in* not. This is decided based on at least one of the power supplies * being defined in the devicetree node of the device. */ -if (!of_pci_supply_present (np)) { +if (!of_pci_supply_present (np) && !of_graph_is_present (np)) {pr_debug ("PCI/pwrctrl: Skipping OF node: %s\n" , np->name); goto err_put_of_node; } --
Quoted 2 lines
2.48.1
PATCH v2 4/4 power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
In reply to Manivannan SadhasivamThis driver is used to control the PCIe M.2 connectors of different Mechanical Keys attached to the host machines and supporting different interfaces like PCIe/SATA, USB/UART etc...
Currently, this driver supports only the Mechanical Key M connectors with PCIe interface. The driver also only supports driving the mandatory 3.3v and optional 1.8v power supplies. The optional signals of the Key M connectors are not currently supported.
--- MAINTAINERS | 7 ++ drivers/power/sequencing/Kconfig | 8 ++ drivers/power/sequencing/Makefile | 1 + drivers/power/sequencing/pwrseq-pcie-m2.c | 163 ++++++++++++++++++++++++++++++ 4 files changed, 179 insertions(+)
MAINTAINERS +7 -0
@@ -20474,6 +20474,13 @@ F: Documentation/driver-api/pwrseq.rst F: drivers/power/sequencing/ F: include/linux/pwrseq/ +PCIE M.2 POWER SEQUENCING +M: Manivannan Sadhasivam <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml +F: drivers/power/sequencing/pwrseq-pcie-m2.c + POWER STATE COORDINATION INTERFACE (PSCI) M: Mark Rutland <[email protected]> M: Lorenzo Pieralisi <[email protected]>
drivers/power/sequencing/Kconfig +8 -0
@@ -35,4 +35,12 @@ config POWER_SEQUENCING_TH1520_GPU GPU. This driver handles the complex clock and reset sequence required to power on the Imagination BXM GPU on this platform. +config POWER_SEQUENCING_PCIE_M2 + tristate "PCIe M.2 connector power sequencing driver" + depends on OF || COMPILE_TEST + help + Say Y here to enable the power sequencing driver for PCIe M.2 + connectors. This driver handles the power sequencing for the M.2 + connectors exposing multiple interfaces like PCIe, SATA, UART, etc... + endif
drivers/power/sequencing/Makefile +1 -0
@@ -5,3 +5,4 @@ pwrseq-core-y := core.o obj-$(CONFIG_POWER_SEQUENCING_QCOM_WCN) += pwrseq-qcom-wcn.o obj-$(CONFIG_POWER_SEQUENCING_TH1520_GPU) += pwrseq-thead-gpu.o +obj-$(CONFIG_POWER_SEQUENCING_PCIE_M2) += pwrseq-pcie-m2.o
drivers/power/sequencing/pwrseq-pcie-m2.c new file +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
Quoted 14 lines · Manivannan Sadhasivam
drivers/power/sequencing/pwrseq-pcie-m2.c new file +13
-0+ +static int pwrseq_pcie_m2_match (struct pwrseq_device *pwrseq, +struct device *dev) +{ +struct pwrseq_pcie_m2_ctx *ctx =pwrseq_device_get_drvdata (pwrseq); +struct device_node *remote, *endpoint; + +/* +* Traverse the 'remote-endpoint' nodes and check if the remote node's +* parent matches the OF node of 'dev'. +*/ +for_each_endpoint_of_node (ctx->of_node, endpoint) { + remote =of_graph_get_remote_port_parent (endpoint);
drivers/power/sequencing/pwrseq-pcie-m2.c line 96
Quoted 10 lines
drivers/power/sequencing/pwrseq-pcie-m2.c new file +10
-0+if (remote && (remote ==dev_of_node (dev))) { +of_node_put (remote); +of_node_put (endpoint); +return PWRSEQ_MATCH_OK ; + } +of_node_put (remote); + } + +return PWRSEQ_NO_MATCH ; +}
Nit: I would simplify this function with __free(device_node) since there'll be a v3 anyway. Other than that it looks good, so when the bindings get acked I assume this can go into the pwrseq/for-next? There don't seem to be any build-time dependencies between this and the PCI part.
Bart
Manivannan Sadhasivam
maintainerRe: [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
Quoted 24 lines · Bartosz Golaszewski
Quoted 22 lines · Manivannan Sadhasivam
drivers/power/sequencing/pwrseq-pcie-m2.c new file +21
-0+ +static int pwrseq_pcie_m2_match (struct pwrseq_device *pwrseq, +struct device *dev) +{ +struct pwrseq_pcie_m2_ctx *ctx =pwrseq_device_get_drvdata (pwrseq); +struct device_node *remote, *endpoint; + +/* +* Traverse the 'remote-endpoint' nodes and check if the remote node's +* parent matches the OF node of 'dev'. +*/ +for_each_endpoint_of_node (ctx->of_node, endpoint) { + remote =of_graph_get_remote_port_parent (endpoint); +if (remote && (remote ==dev_of_node (dev))) { +of_node_put (remote); +of_node_put (endpoint); +return PWRSEQ_MATCH_OK ; + } +of_node_put (remote); + } +
Quoted 9 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return PWRSEQ_NO_MATCH; +}Nit: I would simplify this function with
__free(device_node)since there'll be a v3 anyway. Other than that it looks good, so when the bindings get acked I assume this can go into the pwrseq/for-next? There don't seem to be any build-time dependencies between this and the PCI part.
Yes. Pwrseq patches can go independently. It won't affect functionality as well, since I haven't submitted the devicetree changes.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்