* [PATCH v2 0/4] PCI: Add initial support for handling PCIe M.2 connectors in devicetree
@ 2025-11-08 3:23 Manivannan Sadhasivam
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-08 3:23 UTC (permalink / raw)
To: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski
Cc: linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm,
Manivannan Sadhasivam
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
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
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/20251105-pci-m2-v1-0-84b5f1f1e5e8@oss.qualcomm.com
---
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,
--
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-08 3:23 [PATCH v2 0/4] PCI: Add initial support for handling PCIe M.2 connectors in devicetree Manivannan Sadhasivam
@ 2025-11-08 3:23 ` Manivannan Sadhasivam
2025-11-08 18:10 ` Dmitry Baryshkov
` (3 more replies)
2025-11-08 3:23 ` [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors Manivannan Sadhasivam
` (2 subsequent siblings)
3 siblings, 4 replies; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-08 3:23 UTC (permalink / raw)
To: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski
Cc: linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm,
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 <manivannan.sadhasivam@oss.qualcomm.com>
---
.../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
1 file changed, 122 insertions(+)
diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
--- /dev/null
+++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
@@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
+
+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
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors
2025-11-08 3:23 [PATCH v2 0/4] PCI: Add initial support for handling PCIe M.2 connectors in devicetree Manivannan Sadhasivam
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
@ 2025-11-08 3:23 ` Manivannan Sadhasivam
2025-11-12 14:59 ` Bartosz Golaszewski
2025-11-08 3:23 ` [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found Manivannan Sadhasivam
2025-11-08 3:23 ` [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors Manivannan Sadhasivam
3 siblings, 1 reply; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-08 3:23 UTC (permalink / raw)
To: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski
Cc: linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm,
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.
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 <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/pci/pwrctrl/Kconfig | 1 +
drivers/pci/pwrctrl/slot.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pwrctrl/Kconfig b/drivers/pci/pwrctrl/Kconfig
index 6956c18548114ce12247b560f1ef159eb7e90b10..9a195cb7e117465625c68301534af22000dfca8d 100644
--- a/drivers/pci/pwrctrl/Kconfig
+++ b/drivers/pci/pwrctrl/Kconfig
@@ -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
diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c
index 3320494b62d890ffbae6f125e2704167ebccf7b9..d46c2365208ac87c4e83ba8d69ac1914d9bf9088 100644
--- a/drivers/pci/pwrctrl/slot.c
+++ b/drivers/pci/pwrctrl/slot.c
@@ -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);
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found
2025-11-08 3:23 [PATCH v2 0/4] PCI: Add initial support for handling PCIe M.2 connectors in devicetree Manivannan Sadhasivam
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
2025-11-08 3:23 ` [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors Manivannan Sadhasivam
@ 2025-11-08 3:23 ` Manivannan Sadhasivam
2025-11-12 15:00 ` Bartosz Golaszewski
2025-11-08 3:23 ` [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors Manivannan Sadhasivam
3 siblings, 1 reply; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-08 3:23 UTC (permalink / raw)
To: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski
Cc: linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm,
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 <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/pci/probe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c83e75a0ec1263298aeac7f84bcf5513b003496c..9c8669e2fe72d7edbc2898d60ffdda5fc769d6f5 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
2025-11-08 3:23 [PATCH v2 0/4] PCI: Add initial support for handling PCIe M.2 connectors in devicetree Manivannan Sadhasivam
` (2 preceding siblings ...)
2025-11-08 3:23 ` [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found Manivannan Sadhasivam
@ 2025-11-08 3:23 ` Manivannan Sadhasivam
2025-11-12 15:04 ` Bartosz Golaszewski
3 siblings, 1 reply; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-08 3:23 UTC (permalink / raw)
To: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski
Cc: linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm,
Manivannan Sadhasivam
This 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.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
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(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 46126ce2f968e4f9260263f1574ee29f5ff0de1c..9b3f689d1f50c62afa3772a0c6802f99a98ac2de 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <mani@kernel.org>
+L: linux-pci@vger.kernel.org
+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 <mark.rutland@arm.com>
M: Lorenzo Pieralisi <lpieralisi@kernel.org>
diff --git a/drivers/power/sequencing/Kconfig b/drivers/power/sequencing/Kconfig
index 280f92beb5d0ed524e67a28d1c5dd264bbd6c87e..f5fff84566ba463b55d3cd0c07db34c82f9f1e31 100644
--- a/drivers/power/sequencing/Kconfig
+++ b/drivers/power/sequencing/Kconfig
@@ -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
diff --git a/drivers/power/sequencing/Makefile b/drivers/power/sequencing/Makefile
index 96c1cf0a98ac54c9c1d65a4bb4e34289a3550fa1..0911d461829897c5018e26dbe475b28f6fb6914c 100644
--- a/drivers/power/sequencing/Makefile
+++ b/drivers/power/sequencing/Makefile
@@ -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
diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
new file mode 100644
index 0000000000000000000000000000000000000000..15659b009fb3e01227e40f26d633f675bc2af701
--- /dev/null
+++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
+ */
+
+#include <linux/device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_graph.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pwrseq/provider.h>
+#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
+
+struct pwrseq_pcie_m2_pdata {
+ const struct pwrseq_target_data **targets;
+};
+
+struct pwrseq_pcie_m2_ctx {
+ struct pwrseq_device *pwrseq;
+ struct device_node *of_node;
+ const struct pwrseq_pcie_m2_pdata *pdata;
+ struct regulator_bulk_data *regs;
+ size_t num_vregs;
+ struct notifier_block nb;
+};
+
+static int pwrseq_pcie_m2_m_vregs_enable(struct pwrseq_device *pwrseq)
+{
+ struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
+
+ return regulator_bulk_enable(ctx->num_vregs, ctx->regs);
+}
+
+static int pwrseq_pcie_m2_m_vregs_disable(struct pwrseq_device *pwrseq)
+{
+ struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
+
+ return regulator_bulk_disable(ctx->num_vregs, ctx->regs);
+}
+
+static const struct pwrseq_unit_data pwrseq_pcie_m2_vregs_unit_data = {
+ .name = "regulators-enable",
+ .enable = pwrseq_pcie_m2_m_vregs_enable,
+ .disable = pwrseq_pcie_m2_m_vregs_disable,
+};
+
+static const struct pwrseq_unit_data *pwrseq_pcie_m2_m_unit_deps[] = {
+ &pwrseq_pcie_m2_vregs_unit_data,
+ NULL
+};
+
+static const struct pwrseq_unit_data pwrseq_pcie_m2_m_pcie_unit_data = {
+ .name = "pcie-enable",
+ .deps = pwrseq_pcie_m2_m_unit_deps,
+};
+
+static const struct pwrseq_target_data pwrseq_pcie_m2_m_pcie_target_data = {
+ .name = "pcie",
+ .unit = &pwrseq_pcie_m2_m_pcie_unit_data,
+};
+
+static const struct pwrseq_target_data *pwrseq_pcie_m2_m_targets[] = {
+ &pwrseq_pcie_m2_m_pcie_target_data,
+ NULL
+};
+
+static const struct pwrseq_pcie_m2_pdata pwrseq_pcie_m2_m_of_data = {
+ .targets = pwrseq_pcie_m2_m_targets,
+};
+
+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);
+ }
+
+ return PWRSEQ_NO_MATCH;
+}
+
+static int pwrseq_pcie_m2_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct pwrseq_pcie_m2_ctx *ctx;
+ struct pwrseq_config config = {};
+ int ret;
+
+ ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ ctx->of_node = dev_of_node(dev);
+ ctx->pdata = device_get_match_data(dev);
+ if (!ctx->pdata)
+ return dev_err_probe(dev, -ENODEV,
+ "Failed to obtain platform data\n");
+
+ /*
+ * Currently, of_regulator_bulk_get_all() is the only regulator API that
+ * allows to get all supplies in the devicetree node without manually
+ * specifying them.
+ */
+ ret = of_regulator_bulk_get_all(dev, dev_of_node(dev), &ctx->regs);
+ if (ret < 0)
+ return dev_err_probe(dev, ret,
+ "Failed to get all regulators\n");
+
+ ctx->num_vregs = ret;
+
+ config.parent = dev;
+ config.owner = THIS_MODULE;
+ config.drvdata = ctx;
+ config.match = pwrseq_pcie_m2_match;
+ config.targets = ctx->pdata->targets;
+
+ ctx->pwrseq = devm_pwrseq_device_register(dev, &config);
+ if (IS_ERR(ctx->pwrseq)) {
+ regulator_bulk_free(ctx->num_vregs, ctx->regs);
+ return dev_err_probe(dev, PTR_ERR(ctx->pwrseq),
+ "Failed to register the power sequencer\n");
+ }
+
+ return 0;
+}
+
+static const struct of_device_id pwrseq_pcie_m2_of_match[] = {
+ {
+ .compatible = "pcie-m2-m-connector",
+ .data = &pwrseq_pcie_m2_m_of_data,
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, pwrseq_pcie_m2_of_match);
+
+static struct platform_driver pwrseq_pcie_m2_driver = {
+ .driver = {
+ .name = "pwrseq-pcie-m2",
+ .of_match_table = pwrseq_pcie_m2_of_match,
+ },
+ .probe = pwrseq_pcie_m2_probe,
+};
+module_platform_driver(pwrseq_pcie_m2_driver);
+
+MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>");
+MODULE_DESCRIPTION("Power Sequencing driver for PCIe M.2 connector");
+MODULE_LICENSE("GPL");
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
@ 2025-11-08 18:10 ` Dmitry Baryshkov
2025-11-09 16:18 ` Manivannan Sadhasivam
2025-11-09 18:34 ` Sebastian Reichel
` (2 subsequent siblings)
3 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-11-08 18:10 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> 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 <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> 1 file changed, 122 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> +
> +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?
> +
> + 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
Should it be defined as having two endpoints: one for PCIe, one for
SATA?
> +
> + 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
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-08 18:10 ` Dmitry Baryshkov
@ 2025-11-09 16:18 ` Manivannan Sadhasivam
2025-11-09 20:13 ` Dmitry Baryshkov
0 siblings, 1 reply; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-09 16:18 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Sat, Nov 08, 2025 at 08:10:54PM +0200, Dmitry Baryshkov wrote:
> On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > ---
> > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > 1 file changed, 122 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > +
> > +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?
>
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.
> > +
> > + 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
>
> Should 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
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
2025-11-08 18:10 ` Dmitry Baryshkov
@ 2025-11-09 18:34 ` Sebastian Reichel
2025-11-11 13:54 ` Manivannan Sadhasivam
2025-11-12 3:57 ` Chen-Yu Tsai
2025-11-12 16:54 ` Frank Li
3 siblings, 1 reply; 21+ messages in thread
From: Sebastian Reichel @ 2025-11-09 18:34 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
Hi,
On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> 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 <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> .../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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-09 16:18 ` Manivannan Sadhasivam
@ 2025-11-09 20:13 ` Dmitry Baryshkov
2025-11-11 13:49 ` Manivannan Sadhasivam
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-11-09 20:13 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Sun, Nov 09, 2025 at 09:48:02PM +0530, Manivannan Sadhasivam wrote:
> On Sat, Nov 08, 2025 at 08:10:54PM +0200, Dmitry Baryshkov wrote:
> > On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > ---
> > > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > > 1 file changed, 122 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > +
> > > +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?
> >
>
> 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
>
> > > +
> > > + 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
> >
> > Should 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.
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.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-09 20:13 ` Dmitry Baryshkov
@ 2025-11-11 13:49 ` Manivannan Sadhasivam
2025-11-12 20:12 ` Dmitry Baryshkov
0 siblings, 1 reply; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-11 13:49 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Sun, Nov 09, 2025 at 10:13:59PM +0200, Dmitry Baryshkov wrote:
> On Sun, Nov 09, 2025 at 09:48:02PM +0530, Manivannan Sadhasivam wrote:
> > On Sat, Nov 08, 2025 at 08:10:54PM +0200, Dmitry Baryshkov wrote:
> > > On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > > > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > ---
> > > > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > > > 1 file changed, 122 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > new file mode 100644
> > > > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > +
> > > > +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?
> > >
> >
> > 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
>
> >
> > > > +
> > > > + 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
> > >
> > > Should 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.
>
> 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.
> 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
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-09 18:34 ` Sebastian Reichel
@ 2025-11-11 13:54 ` Manivannan Sadhasivam
0 siblings, 0 replies; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-11 13:54 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm
On Sun, Nov 09, 2025 at 07:34:09PM +0100, Sebastian Reichel wrote:
> Hi,
>
> On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > ---
> > .../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
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.
>
> (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
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
2025-11-08 18:10 ` Dmitry Baryshkov
2025-11-09 18:34 ` Sebastian Reichel
@ 2025-11-12 3:57 ` Chen-Yu Tsai
2025-11-12 14:33 ` Manivannan Sadhasivam
2025-11-12 16:54 ` Frank Li
3 siblings, 1 reply; 21+ messages in thread
From: Chen-Yu Tsai @ 2025-11-12 3:57 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm
On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> 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 <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> 1 file changed, 122 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> +
> +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.
FYI I just added vpcie1v8-supply to the core DT schema [1]. vpcie1v8
instead of vio1v8 was requested by Rob.
[1] https://github.com/devicetree-org/dt-schema/pull/176
> +
> + 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
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-12 3:57 ` Chen-Yu Tsai
@ 2025-11-12 14:33 ` Manivannan Sadhasivam
0 siblings, 0 replies; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-12 14:33 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm
On Wed, Nov 12, 2025 at 11:57:17AM +0800, Chen-Yu Tsai wrote:
> On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > ---
> > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > 1 file changed, 122 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > +
> > +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.
>
> 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
> [1] https://github.com/devicetree-org/dt-schema/pull/176
>
> > +
> > + 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
> >
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors
2025-11-08 3:23 ` [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors Manivannan Sadhasivam
@ 2025-11-12 14:59 ` Bartosz Golaszewski
0 siblings, 0 replies; 21+ messages in thread
From: Bartosz Golaszewski @ 2025-11-12 14:59 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, linux-pci,
devicetree, linux-arm-msm, Stephan Gerhold, Dmitry Baryshkov,
linux-pm
On Sat, Nov 8, 2025 at 4:23 AM Manivannan Sadhasivam
<manivannan.sadhasivam@oss.qualcomm.com> wrote:
>
> 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.
>
> 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 <manivannan.sadhasivam@oss.qualcomm.com>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found
2025-11-08 3:23 ` [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found Manivannan Sadhasivam
@ 2025-11-12 15:00 ` Bartosz Golaszewski
0 siblings, 0 replies; 21+ messages in thread
From: Bartosz Golaszewski @ 2025-11-12 15:00 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, linux-pci,
devicetree, linux-arm-msm, Stephan Gerhold, Dmitry Baryshkov,
linux-pm
On Sat, Nov 8, 2025 at 4:23 AM Manivannan Sadhasivam
<manivannan.sadhasivam@oss.qualcomm.com> wrote:
>
> 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 <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> drivers/pci/probe.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index c83e75a0ec1263298aeac7f84bcf5513b003496c..9c8669e2fe72d7edbc2898d60ffdda5fc769d6f5 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -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;
> }
>
> --
> 2.48.1
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
2025-11-08 3:23 ` [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors Manivannan Sadhasivam
@ 2025-11-12 15:04 ` Bartosz Golaszewski
2025-11-12 15:51 ` Manivannan Sadhasivam
0 siblings, 1 reply; 21+ messages in thread
From: Bartosz Golaszewski @ 2025-11-12 15:04 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, linux-pci,
devicetree, linux-arm-msm, Stephan Gerhold, Dmitry Baryshkov,
linux-pm
On Sat, Nov 8, 2025 at 4:24 AM Manivannan Sadhasivam
<manivannan.sadhasivam@oss.qualcomm.com> wrote:
>
> +
> +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);
> + }
> +
> + 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
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors
2025-11-12 15:04 ` Bartosz Golaszewski
@ 2025-11-12 15:51 ` Manivannan Sadhasivam
0 siblings, 0 replies; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-12 15:51 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, linux-pci,
devicetree, linux-arm-msm, Stephan Gerhold, Dmitry Baryshkov,
linux-pm
On Wed, Nov 12, 2025 at 04:04:51PM +0100, Bartosz Golaszewski wrote:
> On Sat, Nov 8, 2025 at 4:24 AM Manivannan Sadhasivam
> <manivannan.sadhasivam@oss.qualcomm.com> wrote:
> >
> > +
> > +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);
> > + }
> > +
> > + 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
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
` (2 preceding siblings ...)
2025-11-12 3:57 ` Chen-Yu Tsai
@ 2025-11-12 16:54 ` Frank Li
3 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-11-12 16:54 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, Dmitry Baryshkov, linux-pm
On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> 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 <manivannan.sadhasivam@oss.qualcomm.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> 1 file changed, 122 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> +
> +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
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-11 13:49 ` Manivannan Sadhasivam
@ 2025-11-12 20:12 ` Dmitry Baryshkov
2025-11-13 4:57 ` Manivannan Sadhasivam
2025-11-19 23:56 ` Rob Herring
0 siblings, 2 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-11-12 20:12 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Tue, Nov 11, 2025 at 07:19:45PM +0530, Manivannan Sadhasivam wrote:
> On Sun, Nov 09, 2025 at 10:13:59PM +0200, Dmitry Baryshkov wrote:
> > On Sun, Nov 09, 2025 at 09:48:02PM +0530, Manivannan Sadhasivam wrote:
> > > On Sat, Nov 08, 2025 at 08:10:54PM +0200, Dmitry Baryshkov wrote:
> > > > On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > > > > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > > ---
> > > > > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > > > > 1 file changed, 122 insertions(+)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > > new file mode 100644
> > > > > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > > > > --- /dev/null
> > > > > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > > +
> > > > > +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?
> > > >
> > >
> > > 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
> >
> > >
> > > > > +
> > > > > + 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
> > > >
> > > > Should 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.
> >
> > 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.
How would you model this in the actual DT? We don't have separate
PCIe/SATA muxes in DT, do we?
>
> > 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.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-12 20:12 ` Dmitry Baryshkov
@ 2025-11-13 4:57 ` Manivannan Sadhasivam
2025-11-19 23:56 ` Rob Herring
1 sibling, 0 replies; 21+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-13 4:57 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Manivannan Sadhasivam, Bjorn Helgaas, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Wed, Nov 12, 2025 at 10:12:36PM +0200, Dmitry Baryshkov wrote:
> On Tue, Nov 11, 2025 at 07:19:45PM +0530, Manivannan Sadhasivam wrote:
> > On Sun, Nov 09, 2025 at 10:13:59PM +0200, Dmitry Baryshkov wrote:
> > > On Sun, Nov 09, 2025 at 09:48:02PM +0530, Manivannan Sadhasivam wrote:
> > > > On Sat, Nov 08, 2025 at 08:10:54PM +0200, Dmitry Baryshkov wrote:
> > > > > On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > > > > > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > > > ---
> > > > > > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > > > > > 1 file changed, 122 insertions(+)
> > > > > >
> > > > > > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > > > new file mode 100644
> > > > > > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > > > > > --- /dev/null
> > > > > > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > > > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > > > +
> > > > > > +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?
> > > > >
> > > >
> > > > 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
> > >
> > > >
> > > > > > +
> > > > > > + 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
> > > > >
> > > > > Should 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.
> > >
> > > 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.
>
> 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
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector
2025-11-12 20:12 ` Dmitry Baryshkov
2025-11-13 4:57 ` Manivannan Sadhasivam
@ 2025-11-19 23:56 ` Rob Herring
1 sibling, 0 replies; 21+ messages in thread
From: Rob Herring @ 2025-11-19 23:56 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Manivannan Sadhasivam, Manivannan Sadhasivam, Bjorn Helgaas,
Krzysztof Kozlowski, Conor Dooley, Bartosz Golaszewski,
linux-kernel, linux-pci, devicetree, linux-arm-msm,
Stephan Gerhold, linux-pm
On Wed, Nov 12, 2025 at 10:12:36PM +0200, Dmitry Baryshkov wrote:
> On Tue, Nov 11, 2025 at 07:19:45PM +0530, Manivannan Sadhasivam wrote:
> > On Sun, Nov 09, 2025 at 10:13:59PM +0200, Dmitry Baryshkov wrote:
> > > On Sun, Nov 09, 2025 at 09:48:02PM +0530, Manivannan Sadhasivam wrote:
> > > > On Sat, Nov 08, 2025 at 08:10:54PM +0200, Dmitry Baryshkov wrote:
> > > > > On Sat, Nov 08, 2025 at 08:53:19AM +0530, Manivannan Sadhasivam wrote:
> > > > > > 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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > > > ---
> > > > > > .../bindings/connector/pcie-m2-m-connector.yaml | 122 +++++++++++++++++++++
> > > > > > 1 file changed, 122 insertions(+)
> > > > > >
> > > > > > diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > > > new file mode 100644
> > > > > > index 0000000000000000000000000000000000000000..be0a3b43e8fd2a2a3b76cad4808ddde79dceaa21
> > > > > > --- /dev/null
> > > > > > +++ b/Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> > > > > > @@ -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 <manivannan.sadhasivam@oss.qualcomm.com>
> > > > > > +
> > > > > > +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?
> > > > >
> > > >
> > > > 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
> > >
> > > >
> > > > > > +
> > > > > > + 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
> > > > >
> > > > > Should 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.
> > >
> > > 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.
>
> 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
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2025-11-19 23:56 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-08 3:23 [PATCH v2 0/4] PCI: Add initial support for handling PCIe M.2 connectors in devicetree Manivannan Sadhasivam
2025-11-08 3:23 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key M connector Manivannan Sadhasivam
2025-11-08 18:10 ` Dmitry Baryshkov
2025-11-09 16:18 ` Manivannan Sadhasivam
2025-11-09 20:13 ` Dmitry Baryshkov
2025-11-11 13:49 ` Manivannan Sadhasivam
2025-11-12 20:12 ` Dmitry Baryshkov
2025-11-13 4:57 ` Manivannan Sadhasivam
2025-11-19 23:56 ` Rob Herring
2025-11-09 18:34 ` Sebastian Reichel
2025-11-11 13:54 ` Manivannan Sadhasivam
2025-11-12 3:57 ` Chen-Yu Tsai
2025-11-12 14:33 ` Manivannan Sadhasivam
2025-11-12 16:54 ` Frank Li
2025-11-08 3:23 ` [PATCH v2 2/4] PCI/pwrctrl: Add support for handling PCIe M.2 connectors Manivannan Sadhasivam
2025-11-12 14:59 ` Bartosz Golaszewski
2025-11-08 3:23 ` [PATCH v2 3/4] PCI/pwrctrl: Create pwrctrl device if the graph port is found Manivannan Sadhasivam
2025-11-12 15:00 ` Bartosz Golaszewski
2025-11-08 3:23 ` [PATCH v2 4/4] power: sequencing: Add the Power Sequencing driver for the PCIe M.2 connectors Manivannan Sadhasivam
2025-11-12 15:04 ` Bartosz Golaszewski
2025-11-12 15:51 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).